diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-27 13:29:52 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-27 13:29:52 +0000 |
commit | e837694788dc1d70ada513c1c5b7e53c2e45a01d (patch) | |
tree | 9de3c80f0084379d6950602b4c24ba0057eb2554 /gcc/ada/gnatcmd.adb | |
parent | 8b8c291df635a4bc027732ccded6c488679eb41a (diff) | |
download | gcc-e837694788dc1d70ada513c1c5b7e53c2e45a01d.tar.gz |
2010-01-27 Vincent Celier <celier@adacore.com>
* gnatcmd.adb: When there is only one main specified, the package
support Switches (<main>) and attribute Switches is specified for the
main, use these switches, instead of Default_Switches ("Ada").
2010-01-27 Robert Dewar <dewar@adacore.com>
* sem_prag.adb, par-prag.adb, snames.ads-tmpl: pragma Dimension initial
implementation.
* exp_disp.adb: Minor reformatting
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156283 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatcmd.adb')
-rw-r--r-- | gcc/ada/gnatcmd.adb | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 8d246759e48..6ab6821a63d 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -1807,12 +1807,14 @@ begin Element : Package_Element; - Default_Switches_Array : Array_Element_Id; + Switches_Array : Array_Element_Id; The_Switches : Prj.Variable_Value; Current : Prj.String_List_Id; The_String : String_Element; + Main : String_Access := null; + begin if Pkg /= No_Package then Element := Project_Tree.Packages.Table (Pkg); @@ -1838,8 +1840,37 @@ begin -- name of the programming language. else + -- First check if there is a single main + + for J in 1 .. Last_Switches.Last loop + if Last_Switches.Table (J) (1) /= '-' then + if Main = null then + Main := Last_Switches.Table (J); + + else + Main := null; + exit; + end if; + end if; + end loop; + + if Main /= null then + Switches_Array := + Prj.Util.Value_Of + (Name => Name_Switches, + In_Arrays => Element.Decl.Arrays, + In_Tree => Project_Tree); + Name_Len := 0; + Add_Str_To_Name_Buffer (Main.all); + The_Switches := Prj.Util.Value_Of + (Index => Name_Find, + Src_Index => 0, + In_Array => Switches_Array, + In_Tree => Project_Tree); + end if; + if The_Switches.Kind = Prj.Undefined then - Default_Switches_Array := + Switches_Array := Prj.Util.Value_Of (Name => Name_Default_Switches, In_Arrays => Element.Decl.Arrays, @@ -1847,7 +1878,7 @@ begin The_Switches := Prj.Util.Value_Of (Index => Name_Ada, Src_Index => 0, - In_Array => Default_Switches_Array, + In_Array => Switches_Array, In_Tree => Project_Tree); end if; end if; |