From 8a78c50d6e09186aa53a95310db705d118ec4bb1 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 10 Apr 2009 16:43:28 +0200 Subject: [PATCH] [multiple changes] 2009-04-10 Ed Schonberg * exp_attr.adb (Expand_N_Attribute_Reference, case 'Tag): If the tagged type is a synchronized type, retrieve tag information from the corresponding record, which has the dispatch table link. 2009-04-10 Jerome Lambourg * g-comlin.adb (Group_Analysis): Take care of switches that might be decomposed afterwards, but are present as-is in the command line configuration, and thus should be kept as-is. From-SVN: r145913 --- gcc/ada/ChangeLog | 12 +++++++++++ gcc/ada/exp_attr.adb | 7 +++++++ gcc/ada/g-comlin.adb | 47 ++++++++++++++++++++++++++++++++------------ 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0849bdab921..a0c2729405e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2009-04-10 Ed Schonberg + + * exp_attr.adb (Expand_N_Attribute_Reference, case 'Tag): If the tagged + type is a synchronized type, retrieve tag information from the + corresponding record, which has the dispatch table link. + +2009-04-10 Jerome Lambourg + + * g-comlin.adb (Group_Analysis): Take care of switches that might be + decomposed afterwards, but are present as-is in the command line + configuration, and thus should be kept as-is. + 2009-04-10 Robert Dewar * gnat_rm.texi: Document that postconditions are tested on implicit diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 532fd7690a3..6c3d1d4be6e 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -4341,6 +4341,13 @@ package body Exp_Attr is Ttyp := Underlying_Type (Ttyp); + -- Ada 2005: The type may be a synchronized tagged type, in which + -- case the tag information is stored in the corresponding record. + + if Is_Concurrent_Type (Ttyp) then + Ttyp := Corresponding_Record_Type (Ttyp); + end if; + if Prefix_Is_Type then -- For VMs we leave the type attribute unexpanded because diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb index adb1553836e..307f890750e 100644 --- a/gcc/ada/g-comlin.adb +++ b/gcc/ada/g-comlin.adb @@ -1509,22 +1509,43 @@ package body GNAT.Command_Line is end Group_Analysis; begin - -- Are we adding a switch that can in fact be expanded through aliases ? - -- If yes, we add separately each of its expansion. + -- 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, + -- add separately each of its expansions. -- This takes care of expansions like "-T" -> "-gnatwrs", where the -- alias and its expansion do not have the same prefix. Given the order -- in which we do things here, the expansion of the alias will itself - -- be checked for a common prefix and further split into simple switches + -- 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 + if Cmd.Config.Aliases (A).all = Switch and then Parameter = "" then For_Each_Simple_Switch (Cmd, Cmd.Config.Expansions (A).all, ""); return; @@ -1532,18 +1553,17 @@ package body GNAT.Command_Line is end loop; end if; - -- Are we adding a switch grouping several switches ? If yes, add each - -- of the simple switches instead. + -- 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 + 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 @@ -1560,8 +1580,9 @@ package body GNAT.Command_Line is (Switch'First + Cmd.Config.Prefixes (P)'Length .. Switch'Last)) then - -- Recursive calls already done on each switch of the - -- group. Let's return to not call Callback. + -- Recursive calls already done on each switch of the group: + -- Return without executing Callback. + return; end if; end if;