diff mbox

[Ada] gnatmake -s -gnatn1 always recompiles

Message ID 20120717101518.GA26226@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet July 17, 2012, 10:15 a.m. UTC
This patch ensures that when -gnatn1 is used gnatmake -s will not
always recompile.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-17  Vincent Celier  <celier@adacore.com>

	* switch-m.adb (Normalize_Compiler_Switches): Recognize new
	switches -gnatn1 and -gnatn2.
diff mbox

Patch

Index: switch-m.adb
===================================================================
--- switch-m.adb	(revision 189565)
+++ switch-m.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2012, 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- --
@@ -236,7 +236,7 @@ 
                   --  One-letter switches
 
                   when 'a' | 'A' | 'b' | 'B' | 'c' | 'C' | 'E' | 'f' |
-                       'F' | 'g' | 'h' | 'H' | 'I' | 'L' | 'n' | 'N' |
+                       'F' | 'g' | 'h' | 'H' | 'I' | 'L' | 'N' |
                        'o' | 'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 'S' |
                        't' | 'u' | 'U' | 'v' | 'x' | 'X' | 'Z' =>
                      Storing (First_Stored) := C;
@@ -423,6 +423,24 @@ 
                         return;
                      end if;
 
+                  --  -gnatn may be -gnatn, -gnatn1 or -gnat2
+
+                  when 'n' =>
+                     Last_Stored := First_Stored;
+                     Storing (Last_Stored) := 'n';
+                     Ptr := Ptr + 1;
+
+                     if Ptr <= Max
+                       and then Switch_Chars (Ptr) in '1' .. '2'
+                     then
+                        Last_Stored := Last_Stored + 1;
+                        Storing (Last_Stored) := Switch_Chars (Ptr);
+                        Ptr := Ptr + 1;
+                     end if;
+
+                     Add_Switch_Component
+                       (Storing (Storing'First .. Last_Stored));
+
                   --  -gnatR may be followed by '0', '1', '2' or '3',
                   --  then by 's'