[Ada] fix handling of -gnat83/95/05 switches

Arnaud Charlet charlet@adacore.com
Fri Mar 18 11:47:00 GMT 2005


Tested under i686-linux, committed on mainline.

Fix bad handling of -gnat83/95/05 switches in gnatmake.
Test case (with any hello.adb):
gnatmake -s -gnat95 hello.adb
gnatmake -s -gnat95 hello.adb

The second call should not recompile the file.

2005-03-17  Vincent Celier  <celier@adacore.com>

	* switch-m.adb (Normalize_Compiler_Switches): Recognize switches
	-gnat83, -gnat95 and -gnat05.

-------------- next part --------------
Index: switch-m.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/switch-m.adb,v
retrieving revision 1.10
diff -u -p -r1.10 switch-m.adb
--- switch-m.adb	10 May 2004 16:18:53 -0000	1.10
+++ switch-m.adb	18 Mar 2005 11:17:35 -0000
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2004 Free Software Foundation, Inc.          --
+--          Copyright (C) 2001-2005 Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -404,6 +404,50 @@ package body Switch.M is
                         end if;
                      end loop;
 
+                  --  -gnat95 -gnat05
+
+                  when '0' | '9' =>
+                     Last_Stored := First_Stored;
+                     Storing (Last_Stored) := C;
+                     Ptr := Ptr + 1;
+
+                     if Ptr /= Max or else Switch_Chars (Ptr) /= '5' then
+
+                        --  Invalid switch
+
+                        Last := 0;
+                        return;
+
+                     else
+                        Last_Stored := Last_Stored + 1;
+                        Storing (Last_Stored) := '5';
+                        Add_Switch_Component
+                          (Storing (Storing'First .. Last_Stored));
+                        Ptr := Ptr + 1;
+                     end if;
+
+                  --  -gnat83
+
+                  when '8' =>
+                     Last_Stored := First_Stored;
+                     Storing (Last_Stored) := '8';
+                     Ptr := Ptr + 1;
+
+                     if Ptr /= Max or else Switch_Chars (Ptr) /= '3' then
+
+                        --  Invalid switch
+
+                        Last := 0;
+                        return;
+
+                     else
+                        Last_Stored := Last_Stored + 1;
+                        Storing (Last_Stored) := '3';
+                        Add_Switch_Component
+                          (Storing (Storing'First .. Last_Stored));
+                        Ptr := Ptr + 1;
+                     end if;
+
                   --  Not a valid switch
 
                   when others =>


More information about the Gcc-patches mailing list