===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 2002-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- --
@@ -292,8 +292,8 @@
Result.Value := End_String;
end if;
- -- Now, check the syntax of the symbol (we don't allow accented and
- -- wide characters)
+ -- Now, check the syntax of the symbol (we don't allow accented or
+ -- wide characters).
if Name_Buffer (1) not in 'a' .. 'z'
and then Name_Buffer (1) not in 'A' .. 'Z'
@@ -356,7 +356,7 @@
begin
-- Always return False when not inside an #if statement
- if Pp_States.Last = Ground then
+ if Opt.No_Deletion or else Pp_States.Last = Ground then
return False;
else
return Pp_States.Table (Pp_States.Last).Deleting;
===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 2003-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- --
@@ -60,6 +60,7 @@
Undef_False : Boolean := False;
Always_Blank : Boolean := False;
Comments : Boolean := False;
+ No_Deletion : Boolean := False;
List_Symbols : Boolean := False;
Processed : Boolean := False;
end record;
@@ -73,6 +74,7 @@
Undef_False => False,
Always_Blank => False,
Comments => False,
+ No_Deletion => False,
List_Symbols => False,
Processed => False);
@@ -330,6 +332,16 @@
-- significant.
case Sinput.Source (Token_Ptr) is
+ when 'a' =>
+
+ -- All source text preserved (also implies -u)
+
+ if Name_Len = 1 then
+ Current_Data.No_Deletion := True;
+ Current_Data.Undef_False := True;
+ OK := True;
+ end if;
+
when 'u' =>
-- Undefined symbol are False
@@ -581,15 +593,15 @@
-- Set the preprocessing flags according to the preprocessing data
- if Current_Data.Comments and then not Current_Data.Always_Blank then
+ if Current_Data.Comments and not Current_Data.Always_Blank then
Comment_Deleted_Lines := True;
Blank_Deleted_Lines := False;
-
else
Comment_Deleted_Lines := False;
Blank_Deleted_Lines := True;
end if;
+ No_Deletion := Current_Data.No_Deletion;
Undefined_Symbols_Are_False := Current_Data.Undef_False;
List_Preprocessing_Symbols := Current_Data.List_Symbols;
===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 2002-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- --
@@ -720,7 +720,7 @@
loop
begin
- Switch := GNAT.Command_Line.Getopt ("D: b c C r s T u v");
+ Switch := GNAT.Command_Line.Getopt ("D: a b c C r s T u v");
case Switch is
@@ -731,6 +731,10 @@
Process_Command_Line_Symbol_Definition
(S => GNAT.Command_Line.Parameter);
+ when 'a' =>
+ Opt.No_Deletion := True;
+ Opt.Undefined_Symbols_Are_False := True;
+
when 'b' =>
Opt.Blank_Deleted_Lines := True;
===================================================================
@@ -968,6 +968,12 @@
-- in this variable (e.g. 2 = select second unit in file). A value of
-- zero indicates that we are in normal (one unit per file) mode.
+ No_Deletion : Boolean := False;
+ -- GNATPREP
+ -- Set by preprocessor switch -a. Do not eliminate any source text. Implies
+ -- Undefined_Symbols_Are_False. Useful to perform a syntax check on all
+ -- branches of #if constructs.
+
No_Main_Subprogram : Boolean := False;
-- GNATMAKE, GNATBIND
-- Set to True if compilation/binding of a program without main