Commit a8930b80 by Arnaud Charlet

[multiple changes]

2010-09-09  Vincent Celier  <celier@adacore.com>

	* prj-proc.adb: Minor comment spelling error fix.
	* osint.ads (Env_Vars_Case_Sensitive): Use function
	Get_Env_Vars_Case_Sensitive, not Get_File_Names_Case_Sensitive to
	compute value.

2010-09-09  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb (Resolve_Equality_Op): Implement Ada2012 rule for
	resolution of conditional expressions whose dependent expressions are
	anonymous access types.

2010-09-09  Robert Dewar  <dewar@adacore.com>

	* a-ststio.adb: Minor code reorganization.
	* s-direio.adb, prj.adb, prj-nmsc.adb, sem_type.adb: Remove redundant
	conversion.
	* types.ads: Minor reformatting.
	* binde.adb, vms_conv.adb, gnatls.adb, s-strxdr.adb, uintp.adb: Remove
	redundant conversions.
	* output.adb: Minor reformatting.
	* sem_ch8.adb (Find_Type): Test for redundant base applies to user
	types.
	* opt.ads: Add pragma Ordered for Verbosity_Level.
	* prj.ads: Add pragma Ordered for type Verbosity.

From-SVN: r164072
parent d2795d58
2010-09-09 Vincent Celier <celier@adacore.com> 2010-09-09 Vincent Celier <celier@adacore.com>
* prj-proc.adb: Minor comment spelling error fix.
* osint.ads (Env_Vars_Case_Sensitive): Use function
Get_Env_Vars_Case_Sensitive, not Get_File_Names_Case_Sensitive to
compute value.
2010-09-09 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb (Resolve_Equality_Op): Implement Ada2012 rule for
resolution of conditional expressions whose dependent expressions are
anonymous access types.
2010-09-09 Robert Dewar <dewar@adacore.com>
* a-ststio.adb: Minor code reorganization.
* s-direio.adb, prj.adb, prj-nmsc.adb, sem_type.adb: Remove redundant
conversion.
* types.ads: Minor reformatting.
* binde.adb, vms_conv.adb, gnatls.adb, s-strxdr.adb, uintp.adb: Remove
redundant conversions.
* output.adb: Minor reformatting.
* sem_ch8.adb (Find_Type): Test for redundant base applies to user
types.
* opt.ads: Add pragma Ordered for Verbosity_Level.
* prj.ads: Add pragma Ordered for type Verbosity.
2010-09-09 Vincent Celier <celier@adacore.com>
* osint.adb (Canonical_Case_File_Name): Use procedure To_Lower in * osint.adb (Canonical_Case_File_Name): Use procedure To_Lower in
System.Case_Util System.Case_Util
(Canonical_Case_Env_Var_Name): Ditto (Canonical_Case_Env_Var_Name): Ditto
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -147,7 +147,7 @@ package body Ada.Streams.Stream_IO is ...@@ -147,7 +147,7 @@ package body Ada.Streams.Stream_IO is
function End_Of_File (File : File_Type) return Boolean is function End_Of_File (File : File_Type) return Boolean is
begin begin
FIO.Check_Read_Status (AP (File)); FIO.Check_Read_Status (AP (File));
return Count (File.Index) > Size (File); return File.Index > Size (File);
end End_Of_File; end End_Of_File;
----------- -----------
...@@ -175,7 +175,7 @@ package body Ada.Streams.Stream_IO is ...@@ -175,7 +175,7 @@ package body Ada.Streams.Stream_IO is
function Index (File : File_Type) return Positive_Count is function Index (File : File_Type) return Positive_Count is
begin begin
FIO.Check_File_Open (AP (File)); FIO.Check_File_Open (AP (File));
return Count (File.Index); return File.Index;
end Index; end Index;
------------- -------------
......
...@@ -614,7 +614,7 @@ package body Binde is ...@@ -614,7 +614,7 @@ package body Binde is
Write_Str (" decrementing Num_Pred for unit "); Write_Str (" decrementing Num_Pred for unit ");
Write_Unit_Name (Units.Table (U).Uname); Write_Unit_Name (Units.Table (U).Uname);
Write_Str (" new value = "); Write_Str (" new value = ");
Write_Int (Int (UNR.Table (U).Num_Pred)); Write_Int (UNR.Table (U).Num_Pred);
Write_Eol; Write_Eol;
end if; end if;
...@@ -1152,7 +1152,7 @@ package body Binde is ...@@ -1152,7 +1152,7 @@ package body Binde is
Write_Str Write_Str
(" Elaborate_Body = True, Num_Pred for body = "); (" Elaborate_Body = True, Num_Pred for body = ");
Write_Int Write_Int
(Int (UNR.Table (Corresponding_Body (U)).Num_Pred)); (UNR.Table (Corresponding_Body (U)).Num_Pred);
else else
Write_Str Write_Str
(" Elaborate_Body = False"); (" Elaborate_Body = False");
...@@ -1243,8 +1243,7 @@ package body Binde is ...@@ -1243,8 +1243,7 @@ package body Binde is
goto Next_With; goto Next_With;
end if; end if;
Withed_Unit := Withed_Unit := Unit_Id_Of (Withs.Table (W).Uname);
Unit_Id (Unit_Id_Of (Withs.Table (W).Uname));
-- Pragma Elaborate_All case, for this we use the recursive -- Pragma Elaborate_All case, for this we use the recursive
-- Elab_All_Links procedure to establish the links. -- Elab_All_Links procedure to establish the links.
......
...@@ -1362,13 +1362,11 @@ procedure Gnatls is ...@@ -1362,13 +1362,11 @@ procedure Gnatls is
declare declare
Src_Path_Name : constant String_Ptr := Src_Path_Name : constant String_Ptr :=
String_Ptr Get_RTS_Search_Dir
(Get_RTS_Search_Dir (Argv (7 .. Argv'Last), Include);
(Argv (7 .. Argv'Last), Include));
Lib_Path_Name : constant String_Ptr := Lib_Path_Name : constant String_Ptr :=
String_Ptr Get_RTS_Search_Dir
(Get_RTS_Search_Dir (Argv (7 .. Argv'Last), Objects);
(Argv (7 .. Argv'Last), Objects));
begin begin
if Src_Path_Name /= null if Src_Path_Name /= null
......
...@@ -1306,6 +1306,7 @@ package Opt is ...@@ -1306,6 +1306,7 @@ package Opt is
-- information sent to standard output, also header, copyright and summary) -- information sent to standard output, also header, copyright and summary)
type Verbosity_Level_Type is (None, Low, Medium, High); type Verbosity_Level_Type is (None, Low, Medium, High);
pragma Ordered (Verbosity_Level_Type);
Verbosity_Level : Verbosity_Level_Type := High; Verbosity_Level : Verbosity_Level_Type := High;
-- GNATMAKE, GPRMAKE -- GNATMAKE, GPRMAKE
-- Modified by gnatmake or gprmake switches -v, -vl, -vm, -vh. Indicates -- Modified by gnatmake or gprmake switches -v, -vl, -vm, -vh. Indicates
......
...@@ -98,7 +98,7 @@ package Osint is ...@@ -98,7 +98,7 @@ package Osint is
pragma Import (C, Get_Env_Vars_Case_Sensitive, pragma Import (C, Get_Env_Vars_Case_Sensitive,
"__gnat_get_env_vars_case_sensitive"); "__gnat_get_env_vars_case_sensitive");
Env_Vars_Case_Sensitive : constant Boolean := Env_Vars_Case_Sensitive : constant Boolean :=
Get_File_Names_Case_Sensitive /= 0; Get_Env_Vars_Case_Sensitive /= 0;
-- Set to indicate whether the operating system convention is for -- Set to indicate whether the operating system convention is for
-- environment variable names to be case sensitive (e.g., in Unix, set -- environment variable names to be case sensitive (e.g., in Unix, set
-- True), or non case sensitive (e.g., in Windows, set False). -- True), or non case sensitive (e.g., in Windows, set False).
......
...@@ -129,8 +129,9 @@ package body Output is ...@@ -129,8 +129,9 @@ package body Output is
else else
declare declare
Indented_Buffer : constant String Indented_Buffer : constant String :=
:= (1 .. Cur_Indentation => ' ') & Buffer (1 .. Len); (1 .. Cur_Indentation => ' ') &
Buffer (1 .. Len);
begin begin
Write_Buffer (Indented_Buffer); Write_Buffer (Indented_Buffer);
end; end;
...@@ -138,9 +139,10 @@ package body Output is ...@@ -138,9 +139,10 @@ package body Output is
exception exception
when Write_Error => when Write_Error =>
-- If there are errors with standard error, just quit.
-- Otherwise, set the output to standard error before reporting -- If there are errors with standard error just quit. Otherwise
-- a failure and quitting. -- set the output to standard error before reporting a failure
-- and quitting.
if Current_FD /= Standerr then if Current_FD /= Standerr then
Current_FD := Standerr; Current_FD := Standerr;
......
...@@ -5505,7 +5505,7 @@ package body Prj.Nmsc is ...@@ -5505,7 +5505,7 @@ package body Prj.Nmsc is
Element := Data.Tree.String_Elements.Table (Current); Element := Data.Tree.String_Elements.Table (Current);
if Element.Value /= No_Name then if Element.Value /= No_Name then
Element.Value := Element.Value :=
Name_Id (Canonical_Case_File_Name (Name_Id (Element.Value))); Name_Id (Canonical_Case_File_Name (Element.Value));
Data.Tree.String_Elements.Table (Current) := Element; Data.Tree.String_Elements.Table (Current) := Element;
end if; end if;
...@@ -6519,7 +6519,7 @@ package body Prj.Nmsc is ...@@ -6519,7 +6519,7 @@ package body Prj.Nmsc is
if not Found then if not Found then
Error_Msg_Name_1 := Name_Id (Source.Display_File); Error_Msg_Name_1 := Name_Id (Source.Display_File);
Error_Msg_Name_2 := Name_Id (Source.Unit.Name); Error_Msg_Name_2 := Source.Unit.Name;
Error_Or_Warning Error_Or_Warning
(Data.Flags, Data.Flags.Missing_Source_Files, (Data.Flags, Data.Flags.Missing_Source_Files,
"source file %% for unit %% not found", "source file %% for unit %% not found",
......
...@@ -346,7 +346,7 @@ package body Prj.Proc is ...@@ -346,7 +346,7 @@ package body Prj.Proc is
Var := In_Tree.Variable_Elements.Table (V1); Var := In_Tree.Variable_Elements.Table (V1);
V1 := Var.Next; V1 := Var.Next;
-- Do not copy the value of attribute inker_Options if Restricted -- Do not copy the value of attribute Linker_Options if Restricted
if Restricted and then Var.Name = Snames.Name_Linker_Options then if Restricted and then Var.Name = Snames.Name_Linker_Options then
Var.Value.Values := Nil_String; Var.Value.Values := Nil_String;
......
...@@ -247,16 +247,10 @@ package body Prj is ...@@ -247,16 +247,10 @@ package body Prj is
return No_File; return No_File;
when Makefile => when Makefile =>
return return Extend_Name (Source_File_Name, Makefile_Dependency_Suffix);
File_Name_Type
(Extend_Name
(Source_File_Name, Makefile_Dependency_Suffix));
when ALI_File => when ALI_File =>
return return Extend_Name (Source_File_Name, ALI_Dependency_Suffix);
File_Name_Type
(Extend_Name
(Source_File_Name, ALI_Dependency_Suffix));
end case; end case;
end Dependency_Name; end Dependency_Name;
......
...@@ -820,6 +820,7 @@ package Prj is ...@@ -820,6 +820,7 @@ package Prj is
Equal => "="); Equal => "=");
type Verbosity is (Default, Medium, High); type Verbosity is (Default, Medium, High);
pragma Ordered (Verbosity);
-- Verbosity when parsing GNAT Project Files -- Verbosity when parsing GNAT Project Files
-- Default is default (very quiet, if no errors). -- Default is default (very quiet, if no errors).
-- Medium is more verbose. -- Medium is more verbose.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -127,7 +127,7 @@ package body System.Direct_IO is ...@@ -127,7 +127,7 @@ package body System.Direct_IO is
function End_Of_File (File : File_Type) return Boolean is function End_Of_File (File : File_Type) return Boolean is
begin begin
FIO.Check_Read_Status (AP (File)); FIO.Check_Read_Status (AP (File));
return Count (File.Index) > Size (File); return File.Index > Size (File);
end End_Of_File; end End_Of_File;
----------- -----------
...@@ -137,7 +137,7 @@ package body System.Direct_IO is ...@@ -137,7 +137,7 @@ package body System.Direct_IO is
function Index (File : File_Type) return Positive_Count is function Index (File : File_Type) return Positive_Count is
begin begin
FIO.Check_File_Open (AP (File)); FIO.Check_File_Open (AP (File));
return Count (File.Index); return File.Index;
end Index; end Index;
---------- ----------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1996-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1996-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GARLIC is free software; you can redistribute it and/or modify it under -- -- GARLIC 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1466,7 +1466,7 @@ package body System.Stream_Attributes is ...@@ -1466,7 +1466,7 @@ package body System.Stream_Attributes is
Exponent := Long_Unsigned (E + E_Bias); Exponent := Long_Unsigned (E + E_Bias);
F := Long_Long_Float'Scaling (F, F_Size - HFS); F := Long_Long_Float'Scaling (F, F_Size - HFS);
Fraction_1 := Long_Long_Unsigned (Long_Long_Float'Floor (F)); Fraction_1 := Long_Long_Unsigned (Long_Long_Float'Floor (F));
F := Long_Long_Float (F - Long_Long_Float (Fraction_1)); F := F - Long_Long_Float (Fraction_1);
F := Long_Long_Float'Scaling (F, HFS); F := Long_Long_Float'Scaling (F, HFS);
Fraction_2 := Long_Long_Unsigned (Long_Long_Float'Floor (F)); Fraction_2 := Long_Long_Unsigned (Long_Long_Float'Floor (F));
end if; end if;
......
...@@ -5766,9 +5766,8 @@ package body Sem_Ch8 is ...@@ -5766,9 +5766,8 @@ package body Sem_Ch8 is
("prefix of Base attribute must be scalar type", ("prefix of Base attribute must be scalar type",
Prefix (N)); Prefix (N));
elsif Sloc (Typ) = Standard_Location elsif Warn_On_Redundant_Constructs
and then Base_Type (Typ) = Typ and then Base_Type (Typ) = Typ
and then Warn_On_Redundant_Constructs
then then
Error_Msg_NE -- CODEFIX Error_Msg_NE -- CODEFIX
("?redundant attribute, & is its own base type", N, Typ); ("?redundant attribute, & is its own base type", N, Typ);
...@@ -5777,8 +5776,8 @@ package body Sem_Ch8 is ...@@ -5777,8 +5776,8 @@ package body Sem_Ch8 is
T := Base_Type (Typ); T := Base_Type (Typ);
-- Rewrite attribute reference with type itself (see similar -- Rewrite attribute reference with type itself (see similar
-- processing in Analyze_Attribute, case Base). Preserve -- processing in Analyze_Attribute, case Base). Preserve prefix
-- prefix if present, for other legality checks. -- if present, for other legality checks.
if Nkind (Prefix (N)) = N_Expanded_Name then if Nkind (Prefix (N)) = N_Expanded_Name then
Rewrite (N, Rewrite (N,
......
...@@ -6391,12 +6391,41 @@ package body Sem_Res is ...@@ -6391,12 +6391,41 @@ package body Sem_Res is
R : constant Node_Id := Right_Opnd (N); R : constant Node_Id := Right_Opnd (N);
T : Entity_Id := Find_Unique_Type (L, R); T : Entity_Id := Find_Unique_Type (L, R);
procedure Check_Conditional_Expression (Cond : Node_Id);
-- The resolution rule for conditional expressions requires that each
-- such must have a unique type. This means that if several dependent
-- expressions are of a non-null anonymous access type, and the context
-- does not impose an expected type (as can be the case in an equality
-- operation) the expression must be rejected.
function Find_Unique_Access_Type return Entity_Id; function Find_Unique_Access_Type return Entity_Id;
-- In the case of allocators, make a last-ditch attempt to find a single -- In the case of allocators, make a last-ditch attempt to find a single
-- access type with the right designated type. This is semantically -- access type with the right designated type. This is semantically
-- dubious, and of no interest to any real code, but c48008a makes it -- dubious, and of no interest to any real code, but c48008a makes it
-- all worthwhile. -- all worthwhile.
----------------------------------
-- Check_Conditional_Expression --
----------------------------------
procedure Check_Conditional_Expression (Cond : Node_Id) is
Then_Expr : Node_Id;
Else_Expr : Node_Id;
begin
if Nkind (Cond) = N_Conditional_Expression then
Then_Expr := Next (First (Expressions (Cond)));
Else_Expr := Next (Then_Expr);
if Nkind (Then_Expr) /= N_Null
and then Nkind (Else_Expr) /= N_Null
then
Error_Msg_N
("cannot determine type of conditional expression", Cond);
end if;
end if;
end Check_Conditional_Expression;
----------------------------- -----------------------------
-- Find_Unique_Access_Type -- -- Find_Unique_Access_Type --
----------------------------- -----------------------------
...@@ -6470,6 +6499,22 @@ package body Sem_Res is ...@@ -6470,6 +6499,22 @@ package body Sem_Res is
Set_Etype (N, Any_Type); Set_Etype (N, Any_Type);
return; return;
end if; end if;
-- Conditional expressions must have a single type, and if the
-- context does not impose one the dependent expressions cannot
-- be anonymous access types.
elsif Ada_Version >= Ada_2012
and then Ekind_In (Etype (L),
E_Anonymous_Access_Type,
E_Anonymous_Access_Subprogram_Type)
and then Ekind_In (Etype (R),
E_Anonymous_Access_Type,
E_Anonymous_Access_Subprogram_Type)
then
Check_Conditional_Expression (L);
Check_Conditional_Expression (R);
end if; end if;
Resolve (L, T); Resolve (L, T);
......
...@@ -3222,7 +3222,7 @@ package body Sem_Type is ...@@ -3222,7 +3222,7 @@ package body Sem_Type is
Write_Str (" Index: "); Write_Str (" Index: ");
Write_Int (Int (Interp_Map.Table (Map_Ptr).Index)); Write_Int (Int (Interp_Map.Table (Map_Ptr).Index));
Write_Str (" Next: "); Write_Str (" Next: ");
Write_Int (Int (Interp_Map.Table (Map_Ptr).Next)); Write_Int (Interp_Map.Table (Map_Ptr).Next);
Write_Eol; Write_Eol;
end Write_Interp_Ref; end Write_Interp_Ref;
......
...@@ -251,13 +251,13 @@ package Types is ...@@ -251,13 +251,13 @@ package Types is
-- Universal integers (type Uint) -- Universal integers (type Uint)
-- Universal reals (type Ureal) -- Universal reals (type Ureal)
-- In most contexts, the strongly typed interface determines which of -- In most contexts, the strongly typed interface determines which of these
-- these types is present. However, there are some situations (involving -- types is present. However, there are some situations (involving untyped
-- untyped traversals of the tree), where it is convenient to be easily -- traversals of the tree), where it is convenient to be easily able to
-- able to distinguish these values. The underlying representation in all -- distinguish these values. The underlying representation in all cases is
-- cases is an integer type Union_Id, and we ensure that the range of -- an integer type Union_Id, and we ensure that the range of the various
-- the various possible values for each of the above types is disjoint -- possible values for each of the above types is disjoint so that this
-- so that this distinction is possible. -- distinction is possible.
type Union_Id is new Int; type Union_Id is new Int;
-- The type in the tree for a union of possible ID values -- The type in the tree for a union of possible ID values
......
...@@ -2204,9 +2204,7 @@ package body Uintp is ...@@ -2204,9 +2204,7 @@ package body Uintp is
and then and then
Int (Right) <= Int (Uint_Max_Simple_Mul) Int (Right) <= Int (Uint_Max_Simple_Mul)
then then
return return UI_From_Int (Direct_Val (Left) * Direct_Val (Right));
UI_From_Int
(Int (Direct_Val (Left)) * Int (Direct_Val (Right)));
end if; end if;
-- Otherwise we have the general case (Algorithm M in Knuth) -- Otherwise we have the general case (Algorithm M in Knuth)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1996-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1996-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -314,16 +314,16 @@ package body VMS_Conv is ...@@ -314,16 +314,16 @@ package body VMS_Conv is
loop loop
declare declare
Dir : constant String_Access := Dir : constant String_Access :=
String_Access (Get_Next_Dir_In_Path (Object_Dir_Name)); Get_Next_Dir_In_Path (Object_Dir_Name);
begin begin
exit when Dir = null; exit when Dir = null;
Object_Dirs := Object_Dirs + 1; Object_Dirs := Object_Dirs + 1;
Object_Dir (Object_Dirs) := Object_Dir (Object_Dirs) :=
new String'("-L" & new String'("-L" &
To_Canonical_Dir_Spec To_Canonical_Dir_Spec
(To_Host_Dir_Spec (To_Host_Dir_Spec
(Normalize_Directory_Name (Dir.all).all, (Normalize_Directory_Name (Dir.all).all,
True).all, True).all); True).all, True).all);
end; end;
end loop; end loop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment