diff gcc/ada/adabkend.adb @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line diff
--- a/gcc/ada/adabkend.adb	Thu Oct 25 07:37:49 2018 +0900
+++ b/gcc/ada/adabkend.adb	Thu Feb 13 11:34:05 2020 +0900
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                     Copyright (C) 2001-2018, AdaCore                     --
+--                     Copyright (C) 2001-2019, 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- --
@@ -117,9 +117,11 @@
 
          --  Set optimization indicators appropriately. In gcc-based GNAT this
          --  is picked up from imported variables set by the gcc driver, but
-         --  for compilers with non-gcc back ends we do it here to allow use
-         --  of these switches by the front end. Allowed optimization switches
-         --  are -Os (optimize for size), -O[0123], and -O (same as -O1).
+         --  for compilers with non-gcc back ends we do it here to allow use of
+         --  these switches by the front end. Allowed optimization switches are
+         --  -Os (optimize for size), -O[0123], -O (same as -O1), -Ofast
+         --  (disregard strict standards compliance), and -Og (optimize
+         --  debugging experience).
 
          elsif Switch_Chars (First) = 'O' then
             if First = Last then
@@ -134,10 +136,21 @@
                   Optimization_Level :=
                     Character'Pos (Switch_Chars (Last)) - Character'Pos ('0');
 
+               --  Switch -Og is between -O0 and -O1 in GCC. Consider it like
+               --  -O0 for other back ends.
+
+               elsif Switch_Chars (Last) = 'g' then
+                  Optimization_Level := 0;
+
                else
                   Fail ("invalid switch: " & Switch_Chars);
                end if;
 
+            --  Switch -Ofast enables -O3
+
+            elsif Switch_Chars (First + 1 .. Last) = "fast" then
+               Optimization_Level := 3;
+
             else
                Fail ("invalid switch: " & Switch_Chars);
             end if;
@@ -169,7 +182,7 @@
 
             return;
 
-         --  Special check, the back end switch -fno-inline also sets the
+         --  Special check, the back-end switch -fno-inline also sets the
          --  front end flags to entirely inhibit all inlining. So we store it
          --  and set the appropriate flags.
 
@@ -186,7 +199,27 @@
             Opt.Suppress_Control_Flow_Optimizations := True;
             return;
 
-         --  Ignore all other back end switches
+         --  Recognize -gxxx switches
+
+         elsif Switch_Chars (First) = 'g' then
+            Debugger_Level := 2;
+
+            if First < Last then
+               case Switch_Chars (First + 1) is
+                  when '0' =>
+                     Debugger_Level := 0;
+                  when '1' =>
+                     Debugger_Level := 1;
+                  when '2' =>
+                     Debugger_Level := 2;
+                  when '3' =>
+                     Debugger_Level := 3;
+                  when others =>
+                     null;
+               end case;
+            end if;
+
+         --  Ignore all other back-end switches
 
          elsif Is_Back_End_Switch (Switch_Chars) then
             null;