[multiple changes]

2009-04-09  Robert Dewar  <dewar@adacore.com>

	* switch-c.adb, gnat_ugn.texi, vms_data.ads, switch.adb,
	switch.ads: for numeric switches, an optional equal sign is always
	allowed.

2009-04-09  Vincent Celier  <celier@adacore.com>

	* prj-nmsc.adb (Get_Unit): Do not consider Casing on platform where
	the case of file names is not significant.

From-SVN: r145834
This commit is contained in:
Arnaud Charlet 2009-04-09 14:34:42 +02:00
parent 5e781161ba
commit f7d7bb5109
7 changed files with 97 additions and 61 deletions

View file

@ -1,3 +1,14 @@
2009-04-09 Robert Dewar <dewar@adacore.com>
* switch-c.adb, gnat_ugn.texi, vms_data.ads, switch.adb,
switch.ads: for numeric switches, an optional equal sign is always
allowed.
2009-04-09 Vincent Celier <celier@adacore.com>
* prj-nmsc.adb (Get_Unit): Do not consider Casing on platform where
the case of file names is not significant.
2009-04-09 Vincent Celier <celier@adacore.com>
* errout.adb: Remove dependency on package Style

View file

@ -3949,7 +3949,7 @@ Note that @option{^-gnatg^/GNAT_INTERNAL^} implies
so that all standard warnings and all standard style options are turned on.
All warnings and style error messages are treated as errors.
@item -gnatGnn
@item -gnatG=nn
@cindex @option{-gnatG[nn]} (@command{gcc})
List generated expanded code in source form.
@ -6796,7 +6796,7 @@ switches in the body of the @code{Debug} unit in the compiler source
file @file{debug.adb}.
@end ifclear
@item -gnatG[nn]
@item -gnatG[=nn]
@cindex @option{-gnatG} (@command{gcc})
This switch causes the compiler to generate auxiliary output containing
a pseudo-source listing of the generated expanded code. Like most Ada
@ -6814,7 +6814,7 @@ approach to improve efficiency.
The optional parameter @code{nn} if present after -gnatG specifies an
alternative maximum line length that overrides the normal default of 72.
This value is in the range 40-999999, values less than 40 being silently
reset to 40.
reset to 40. The equal sign is optional.
The format of the output is very similar to standard Ada source, and is
easily understood by an Ada programmer. The following special syntactic
@ -6899,7 +6899,7 @@ representation in base 2-16 (for example, the result of compile time
evaluation of the expression 1.0/27.0).
@end table
@item -gnatD[nn]
@item -gnatD[=nn]
@cindex @option{-gnatD} (@command{gcc})
When used in conjunction with @option{-gnatG}, this switch causes
the expanded source, as described above for
@ -6930,7 +6930,7 @@ in the expanded source (as comment lines with the original line number).
The optional parameter @code{nn} if present after -gnatD specifies an
alternative maximum line length that overrides the normal default of 72.
This value is in the range 40-999999, values less than 40 being silently
reset to 40.
reset to 40. The equal sign is optional.
@item -gnatr
@cindex @option{-gnatr} (@command{gcc})

View file

@ -6779,38 +6779,42 @@ package body Prj.Nmsc is
end;
end if;
-- Check if the casing is right
-- Check if the file casing is right
declare
Src : String := File (First .. Last);
Src_Last : Positive := Last;
begin
case Naming.Casing is
when All_Lower_Case =>
Fixed.Translate
(Source => Src,
Mapping => Lower_Case_Map);
-- If casing is significant, deal with upper/lower case translate
when All_Upper_Case =>
Fixed.Translate
(Source => Src,
Mapping => Upper_Case_Map);
if File_Names_Case_Sensitive then
case Naming.Casing is
when All_Lower_Case =>
Fixed.Translate
(Source => Src,
Mapping => Lower_Case_Map);
when Mixed_Case | Unknown =>
null;
end case;
when All_Upper_Case =>
Fixed.Translate
(Source => Src,
Mapping => Upper_Case_Map);
if Src /= File (First .. Last) then
if Current_Verbosity = High then
Write_Line (" Not a valid file name (casing).");
when Mixed_Case | Unknown =>
null;
end case;
if Src /= File (First .. Last) then
if Current_Verbosity = High then
Write_Line (" Not a valid file name (casing).");
end if;
Unit_Name := No_Name;
return;
end if;
Unit_Name := No_Name;
return;
end if;
-- We put the name in lower case
-- Put the name in lower case
Fixed.Translate
(Source => Src,

View file

@ -280,7 +280,7 @@ package body Switch.C is
-- Scan optional integer line limit value
if Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' then
if Nat_Present (Switch_Chars, Max, Ptr) then
Scan_Nat (Switch_Chars, Max, Ptr, Sprint_Line_Limit, 'D');
Sprint_Line_Limit := Nat'Max (Sprint_Line_Limit, 40);
end if;
@ -530,7 +530,7 @@ package body Switch.C is
-- Scan optional integer line limit value
if Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' then
if Nat_Present (Switch_Chars, Max, Ptr) then
Scan_Nat (Switch_Chars, Max, Ptr, Sprint_Line_Limit, 'G');
Sprint_Line_Limit := Nat'Max (Sprint_Line_Limit, 40);
end if;
@ -582,13 +582,6 @@ package body Switch.C is
when 'j' =>
Ptr := Ptr + 1;
-- There may be an equal sign between -gnatj and the value
if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
Ptr := Ptr + 1;
end if;
Scan_Nat (Switch_Chars, Max, Ptr, Error_Msg_Line_Length, C);
-- Processing for k switch
@ -626,13 +619,6 @@ package body Switch.C is
when 'm' =>
Ptr := Ptr + 1;
-- There may be an equal sign between -gnatm and the value
if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
Ptr := Ptr + 1;
end if;
Scan_Nat (Switch_Chars, Max, Ptr, Maximum_Messages, C);
-- Processing for n switch

View file

@ -148,6 +148,24 @@ package body Switch is
and then Switch_Chars (Switch_Chars'First) = '-';
end Is_Switch;
-----------------
-- Nat_Present --
-----------------
function Nat_Present
(Switch_Chars : String;
Max : Integer;
Ptr : Integer) return Boolean
is
begin
return (Ptr <= Max
and then Switch_Chars (Ptr) in '0' .. '9')
or else
(Ptr < Max
and then Switch_Chars (Ptr) = '='
and then Switch_Chars (Ptr + 1) in '0' .. '9');
end Nat_Present;
--------------
-- Scan_Nat --
--------------
@ -162,20 +180,24 @@ package body Switch is
begin
Result := 0;
if Ptr > Max or else Switch_Chars (Ptr) not in '0' .. '9' then
if not Nat_Present (Switch_Chars, Max, Ptr) then
Osint.Fail ("missing numeric value for switch: " & Switch);
else
while Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' loop
Result := Result * 10 +
Character'Pos (Switch_Chars (Ptr)) - Character'Pos ('0');
Ptr := Ptr + 1;
if Result > Switch_Max_Value then
Osint.Fail ("numeric value out of range for switch: " & Switch);
end if;
end loop;
end if;
if Switch_Chars (Ptr) = '=' then
Ptr := Ptr + 1;
end if;
while Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' loop
Result :=
Result * 10 +
Character'Pos (Switch_Chars (Ptr)) - Character'Pos ('0');
Ptr := Ptr + 1;
if Result > Switch_Max_Value then
Osint.Fail ("numeric value out of range for switch: " & Switch);
end if;
end loop;
end Scan_Nat;
--------------

View file

@ -81,6 +81,15 @@ private
Switch_Max_Value : constant := 999_999;
-- Maximum value permitted in switches that take a value
function Nat_Present
(Switch_Chars : String;
Max : Integer;
Ptr : Integer) return Boolean;
-- Returns True if an integer is at the current scan location or an equal
-- sign. This is used as a guard for calling Scan_Nat. Switch_Chars is the
-- string containing the switch, and Ptr points just past the switch
-- character. Max is the maximum alllowed value of Ptr.
procedure Scan_Nat
(Switch_Chars : String;
Max : Integer;
@ -91,7 +100,9 @@ private
-- past the switch character, on exit it points past the last digit of the
-- integer value. Max is the maximum allowed value of Ptr, so the scan is
-- restricted to Switch_Chars (Ptr .. Max). It is posssible for Ptr to be
-- one greater than Max on return if the entire string is digits.
-- one greater than Max on return if the entire string is digits. Scan_Nat
-- will skip an optional equal sign if it is present. Nat_Present must be
-- True, or an error will be signalled.
procedure Scan_Pos
(Switch_Chars : String;

View file

@ -131,7 +131,7 @@ package VMS_Data is
-- no space is inserted between the switch and the file name.
-- The NUMERIC_TRANSLATION format is similar to the FILE_TRANSLATION case
-- except that the parameter is a decimal integer in the range 0 to 999.
-- except that the parameter is a decimal integer in the range 0 to 999999.
-- For the OPTIONS_TRANSLATION case, GNATCmd similarly permits one or
-- more options to appear (although only in some cases does the use of
@ -1484,14 +1484,15 @@ package VMS_Data is
"-gnatm999999";
-- NODOC (see /ERROR_LIMIT)
S_GCC_Expand : aliased constant S := "/EXPAND_SOURCE " &
S_GCC_Expand : aliased constant S := "/EXPAND_SOURCE=#" &
"-gnatG";
-- /NOEXPAND_SOURCE (D)
-- /NOEXPAND_SOURCE[=nnn] (D)
-- /EXPAND_SOURCE
--
-- Produces a listing of the expanded code in Ada source form. For
-- example, all tasking constructs are reduced to appropriate run-time
-- library calls.
-- library calls. The parameter is the maximum line length for the
-- listing (default is 72).
S_GCC_Extend : aliased constant S := "/EXTENSIONS_ALLOWED " &
"-gnatX";
@ -3329,9 +3330,9 @@ package VMS_Data is
"-gnatWn";
-- NODOC (see /WIDE_CHARACTER_ENCODING)
S_GCC_Xdebug : aliased constant S := "/XDEBUG " &
S_GCC_Xdebug : aliased constant S := "/XDEBUG=#" &
"-gnatD";
-- /NOXDEBUG (D)
-- /NOXDEBUG[=nnn] (D)
-- /XDEBUG
--
-- Output expanded source files for source level debugging.
@ -3341,7 +3342,8 @@ package VMS_Data is
-- refer to the generated file. This allows source level debugging using
-- the generated code which is sometimes useful for complex code, for
-- example to find out exactly which part of a complex construction
-- raised an exception.
-- raised an exception. The parameter if present is the maximum line
-- length for the output (default 72).
S_GCC_Xref : aliased constant S := "/XREF=" &
"GENERATE " &