aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_prag.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-09-06 12:35:25 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-09-06 12:35:25 +0200
commitf4f92d9d598953d329db09f4dbb0447d85717d88 (patch)
treeb09f42a49b595c51ca661f47a4e6113ec4d568de /gcc/ada/sem_prag.adb
parent4cdccf26659e2463f0c1e06da20cb21ea612b391 (diff)
downloadgcc-f4f92d9d598953d329db09f4dbb0447d85717d88.zip
gcc-f4f92d9d598953d329db09f4dbb0447d85717d88.tar.gz
gcc-f4f92d9d598953d329db09f4dbb0447d85717d88.tar.bz2
[multiple changes]
2011-09-06 Ed Schonberg <schonberg@adacore.com> * exp_ch6.adb (Expand_Inlined_Call): Fix use of uninitialized variable for type of return value when return type is unconstrained and context is an assignment. 2011-09-06 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Check_Class_Wide_Actual): Do not generate body of class-wide operation if expansion is not enabled. 2011-09-06 Eric Botcazou <ebotcazou@adacore.com> * checks.adb (Apply_Scalar_Range_Check): Deal with access type prefix. 2011-09-06 Yannick Moy <moy@adacore.com> * sem_ch13.adb (Analyze_Aspect_Specifications, case Aspect_Invariant): Do not issue error at this point on illegal pragma placement, as this is checked later on when analyzing the corresponding pragma. * sem_prag.adb (Error_Pragma_Arg_Alternate_Name): New procedure similar to Error_Pragma_Arg, except the source name of the aspect/pragma to use in warnings may be equal to parameter Alt_Name (Analyze_Pragma, case Pragma_Invariant): refine error message to distinguish source name of pragma/aspect, and whether the illegality resides in the type being public, or being private without a public declaration 2011-09-06 Thomas Quinot <quinot@adacore.com> * g-socket.adb (Check_For_Fd_Set): On Windows, no need for bitmap size check (fd_set is implemented differently on that platform). 2011-09-06 Thomas Quinot <quinot@adacore.com> * s-taprop-vxworks.adb, s-taprop-tru64.adb, s-taprop-vms.adb, s-tpoaal.adb, s-taprop-mingw.adb, s-taprop-linux.adb, s-taprop-solaris.adb, s-taprop-irix.adb, s-taprop.ads, s-taprop-hpux-dce.adb, s-taprop-dummy.adb, s-taprop-posix.adb (ATCB_Allocation): New subpackage of System.Tasking.Primitive_Operations, shared across all targets with full tasking runtime. (ATCB_Allocation.New_ATCB): Moved there (from target specific s-taprop bodies). (ATCB_Allocation.Free_ATCB): New subprogram. Deallocate an ATCB, taking care of establishing a local temporary ATCB if the one being deallocated is Self, to avoid a reference to the freed ATCB in Abort_Undefer. 2011-09-06 Thomas Quinot <quinot@adacore.com> * s-tassta.adb, s-taskin.ads (Free_Task): If the task is not terminated, mark it for deallocation upon termination. (Terminate_Task): Call Free_Task again if the task is marked for automatic deallocation upon termination. From-SVN: r178582
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r--gcc/ada/sem_prag.adb162
1 files changed, 105 insertions, 57 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 0c204cd..2ca9417 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -29,63 +29,65 @@
-- to complete the syntax checks. Certain pragmas are handled partially or
-- completely by the parser (see Par.Prag for further details).
-with Atree; use Atree;
-with Casing; use Casing;
-with Checks; use Checks;
-with Csets; use Csets;
-with Debug; use Debug;
-with Einfo; use Einfo;
-with Elists; use Elists;
-with Errout; use Errout;
-with Exp_Dist; use Exp_Dist;
-with Exp_Util; use Exp_Util;
-with Freeze; use Freeze;
-with Lib; use Lib;
-with Lib.Writ; use Lib.Writ;
-with Lib.Xref; use Lib.Xref;
-with Namet.Sp; use Namet.Sp;
-with Nlists; use Nlists;
-with Nmake; use Nmake;
-with Opt; use Opt;
-with Output; use Output;
-with Par_SCO; use Par_SCO;
-with Restrict; use Restrict;
-with Rident; use Rident;
-with Rtsfind; use Rtsfind;
-with Sem; use Sem;
-with Sem_Aux; use Sem_Aux;
-with Sem_Ch3; use Sem_Ch3;
-with Sem_Ch6; use Sem_Ch6;
-with Sem_Ch8; use Sem_Ch8;
-with Sem_Ch12; use Sem_Ch12;
-with Sem_Ch13; use Sem_Ch13;
-with Sem_Disp; use Sem_Disp;
-with Sem_Dist; use Sem_Dist;
-with Sem_Elim; use Sem_Elim;
-with Sem_Eval; use Sem_Eval;
-with Sem_Intr; use Sem_Intr;
-with Sem_Mech; use Sem_Mech;
-with Sem_Res; use Sem_Res;
-with Sem_Type; use Sem_Type;
-with Sem_Util; use Sem_Util;
-with Sem_VFpt; use Sem_VFpt;
-with Sem_Warn; use Sem_Warn;
-with Stand; use Stand;
-with Sinfo; use Sinfo;
-with Sinfo.CN; use Sinfo.CN;
-with Sinput; use Sinput;
-with Snames; use Snames;
-with Stringt; use Stringt;
-with Stylesw; use Stylesw;
+with System.Case_Util;
+
+with Atree; use Atree;
+with Casing; use Casing;
+with Checks; use Checks;
+with Csets; use Csets;
+with Debug; use Debug;
+with Einfo; use Einfo;
+with Elists; use Elists;
+with Errout; use Errout;
+with Exp_Dist; use Exp_Dist;
+with Exp_Util; use Exp_Util;
+with Freeze; use Freeze;
+with Lib; use Lib;
+with Lib.Writ; use Lib.Writ;
+with Lib.Xref; use Lib.Xref;
+with Namet.Sp; use Namet.Sp;
+with Nlists; use Nlists;
+with Nmake; use Nmake;
+with Opt; use Opt;
+with Output; use Output;
+with Par_SCO; use Par_SCO;
+with Restrict; use Restrict;
+with Rident; use Rident;
+with Rtsfind; use Rtsfind;
+with Sem; use Sem;
+with Sem_Aux; use Sem_Aux;
+with Sem_Ch3; use Sem_Ch3;
+with Sem_Ch6; use Sem_Ch6;
+with Sem_Ch8; use Sem_Ch8;
+with Sem_Ch12; use Sem_Ch12;
+with Sem_Ch13; use Sem_Ch13;
+with Sem_Disp; use Sem_Disp;
+with Sem_Dist; use Sem_Dist;
+with Sem_Elim; use Sem_Elim;
+with Sem_Eval; use Sem_Eval;
+with Sem_Intr; use Sem_Intr;
+with Sem_Mech; use Sem_Mech;
+with Sem_Res; use Sem_Res;
+with Sem_Type; use Sem_Type;
+with Sem_Util; use Sem_Util;
+with Sem_VFpt; use Sem_VFpt;
+with Sem_Warn; use Sem_Warn;
+with Stand; use Stand;
+with Sinfo; use Sinfo;
+with Sinfo.CN; use Sinfo.CN;
+with Sinput; use Sinput;
+with Snames; use Snames;
+with Stringt; use Stringt;
+with Stylesw; use Stylesw;
with Table;
-with Targparm; use Targparm;
-with Tbuild; use Tbuild;
+with Targparm; use Targparm;
+with Tbuild; use Tbuild;
with Ttypes;
-with Uintp; use Uintp;
-with Uname; use Uname;
-with Urealp; use Urealp;
-with Validsw; use Validsw;
-with Warnsw; use Warnsw;
+with Uintp; use Uintp;
+with Uname; use Uname;
+with Urealp; use Urealp;
+with Validsw; use Validsw;
+with Warnsw; use Warnsw;
package body Sem_Prag is
@@ -646,6 +648,17 @@ package body Sem_Prag is
-- Similar to above form of Error_Pragma_Arg except that two messages
-- are provided, the second is a continuation comment starting with \.
+ procedure Error_Pragma_Arg_Alternate_Name
+ (Msg : String;
+ Arg : Node_Id;
+ Alt_Name : Name_Id);
+ pragma No_Return (Error_Pragma_Arg_Alternate_Name);
+ -- Outputs error message for current pragma, similar to
+ -- Error_Pragma_Arg, except the source name of the aspect/pragma to use
+ -- in warnings may be equal to Alt_Name (which should be equivalent to
+ -- the name used in pragma). The location for the source name should be
+ -- pointed to by Arg.
+
procedure Error_Pragma_Arg_Ident (Msg : String; Arg : Node_Id);
pragma No_Return (Error_Pragma_Arg_Ident);
-- Outputs error message for current pragma. The message may contain
@@ -2427,6 +2440,34 @@ package body Sem_Prag is
Error_Pragma_Arg (Msg2, Arg);
end Error_Pragma_Arg;
+ -------------------------------------
+ -- Error_Pragma_Arg_Alternate_Name --
+ -------------------------------------
+
+ procedure Error_Pragma_Arg_Alternate_Name
+ (Msg : String;
+ Arg : Node_Id;
+ Alt_Name : Name_Id)
+ is
+ MsgF : String := Msg;
+ Source_Name : String := Exact_Source_Name (Sloc (Arg));
+ Alter_Name : String := Get_Name_String (Alt_Name);
+
+ begin
+ System.Case_Util.To_Lower (Source_Name);
+ System.Case_Util.To_Lower (Alter_Name);
+
+ if Source_Name = Alter_Name then
+ Error_Msg_Name_1 := Alt_Name;
+ else
+ Error_Msg_Name_1 := Pname;
+ end if;
+
+ Fix_Error (MsgF);
+ Error_Msg_N (MsgF, Get_Pragma_Arg (Arg));
+ raise Pragma_Exit;
+ end Error_Pragma_Arg_Alternate_Name;
+
----------------------------
-- Error_Pragma_Arg_Ident --
----------------------------
@@ -10140,9 +10181,16 @@ package body Sem_Prag is
then
null;
+ elsif In_Private_Part (Current_Scope) then
+ Error_Pragma_Arg_Alternate_Name
+ ("pragma% only allowed for private type " &
+ "declared in visible part", Arg1,
+ Alt_Name => Name_Type_Invariant);
+
else
- Error_Pragma_Arg
- ("pragma% only allowed for private type", Arg1);
+ Error_Pragma_Arg_Alternate_Name
+ ("pragma% only allowed for private type", Arg1,
+ Alt_Name => Name_Type_Invariant);
end if;
-- Note that the type has at least one invariant, and also that