From cec0185c7e02aa52ffceddbf46a16a66ed47459c Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 26 Sep 2018 09:19:47 +0000 Subject: [PATCH] [Ada] Store -G xxx switches 2018-09-26 Arnaud Charlet gcc/ada/ * back_end.adb (Scan_Compiler_Arguments): Store -G xxx switches. From-SVN: r264634 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/back_end.adb | 25 ++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f8281bde543..5e0adf4bab6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2018-09-26 Arnaud Charlet + + * back_end.adb (Scan_Compiler_Arguments): Store -G xxx switches. + 2018-09-26 Yannick Moy * errout.ads: Update comment for insertion character '?'. diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index 520a8b2deb8..61ab71879bb 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -210,6 +210,9 @@ package body Back_End is Next_Arg : Positive; -- Next argument to be scanned + Arg_Count : constant Natural := Natural (save_argc - 1); + Args : Argument_List (1 .. Arg_Count); + Output_File_Name_Seen : Boolean := False; -- Set to True after having scanned file_name for switch "-gnatO file" @@ -234,14 +237,27 @@ package body Back_End is Last : constant Natural := Switch_Last (Switch_Chars); begin - -- Skip -o, -G or internal GCC switches together with their argument. + -- Skip -o or internal GCC switches together with their argument. if Switch_Chars (First .. Last) = "o" - or else Switch_Chars (First .. Last) = "G" or else Is_Internal_GCC_Switch (Switch_Chars) then Next_Arg := Next_Arg + 1; + -- Store -G xxx as -Gxxx and go directly to the next argument. + + elsif Switch_Chars (First .. Last) = "G" then + Next_Arg := Next_Arg + 1; + + -- Should never get there with -G not followed by an argument, + -- but use defensive code nonetheless. + -- Store as -Gxxx to avoid storing parameters in ALI files that + -- might create confusion. + + if Next_Arg <= Args'Last then + Store_Compilation_Switch (Switch_Chars & Args (Next_Arg).all); + end if; + -- Do not record -quiet switch elsif Switch_Chars (First .. Last) = "quiet" then @@ -294,11 +310,6 @@ package body Back_End is 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 -- 2.30.2