mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-01 20:21:12 +08:00
[multiple changes]
2014-07-30 Ed Schonberg <schonberg@adacore.com> * inline.adb (Expand_Inlined_Call): Use a renaming declaration to capture the value of actuals of a limited type rather than an object declaration, to prevent spurious errors when analyzing the inlined body. 2014-07-30 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Type_Conversion): Treat an inlined body as an instance, and inhibit semantic checks on already analyzed code to prevent spurious errors. 2014-07-30 Arnaud Charlet <charlet@adacore.com> * a-exctra.ads ("="): New function, to restore compatibility. 2014-07-30 Pascal Obry <obry@adacore.com> * adaint.c (__gnat_to_os_time): Set isdst to -1 for the mktime routine to use the OS dst setting. 2014-07-30 Pat Rogers <rogers@adacore.com> * gnat_ugn.texi: Minor correction to description of -gnatw.K. 2014-07-30 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Wrong_Type): Disable some checks equally within instances and within inlined bodies, to suppress spurious type errors on already analyzed code. * sem_aggr.adb (Check_Expr_OK_In_Limited_Aggregate): Expression is legal in an inlined body, juts as it is in an instance body. 2014-07-30 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Unchecked_Conversion): Within an inlined body the operand of an unchecked conversion may be a literal, in which case its type is the target type of the conversion. This is in contrast to conversions in other contexts, where the operand cannot be a literal and must be resolvable independent of the context. From-SVN: r213260
This commit is contained in:
parent
7c02f27b32
commit
36428cc491
@ -1,3 +1,46 @@
|
||||
2014-07-30 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* inline.adb (Expand_Inlined_Call): Use a renaming declaration
|
||||
to capture the value of actuals of a limited type rather than
|
||||
an object declaration, to prevent spurious errors when analyzing
|
||||
the inlined body.
|
||||
|
||||
2014-07-30 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* sem_ch4.adb (Analyze_Type_Conversion): Treat an inlined body
|
||||
as an instance, and inhibit semantic checks on already analyzed
|
||||
code to prevent spurious errors.
|
||||
|
||||
2014-07-30 Arnaud Charlet <charlet@adacore.com>
|
||||
|
||||
* a-exctra.ads ("="): New function, to restore compatibility.
|
||||
|
||||
2014-07-30 Pascal Obry <obry@adacore.com>
|
||||
|
||||
* adaint.c (__gnat_to_os_time): Set isdst to -1 for the mktime
|
||||
routine to use the OS dst setting.
|
||||
|
||||
2014-07-30 Pat Rogers <rogers@adacore.com>
|
||||
|
||||
* gnat_ugn.texi: Minor correction to description of -gnatw.K.
|
||||
|
||||
2014-07-30 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* sem_util.adb (Wrong_Type): Disable some checks equally within
|
||||
instances and within inlined bodies, to suppress spurious type
|
||||
errors on already analyzed code.
|
||||
* sem_aggr.adb (Check_Expr_OK_In_Limited_Aggregate): Expression
|
||||
is legal in an inlined body, juts as it is in an instance body.
|
||||
|
||||
2014-07-30 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* sem_res.adb (Resolve_Unchecked_Conversion): Within an inlined
|
||||
body the operand of an unchecked conversion may be a literal, in
|
||||
which case its type is the target type of the conversion. This
|
||||
is in contrast to conversions in other contexts, where the
|
||||
operand cannot be a literal and must be resolvable independent
|
||||
of the context.
|
||||
|
||||
2014-07-30 Pierre-Marie Derodat <derodat@adacore.com>
|
||||
|
||||
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Create a
|
||||
|
@ -52,6 +52,9 @@ package Ada.Exceptions.Traceback is
|
||||
-- occurrence, and returns it formatted in the manner required for
|
||||
-- processing in GNAT.Traceback. See g-traceb.ads for further details.
|
||||
|
||||
function "=" (A, B : Tracebacks_Array) return Boolean renames STBE."=";
|
||||
-- Make "=" operator visible directly
|
||||
|
||||
function Get_PC (TBE : STBE.Traceback_Entry) return Code_Loc
|
||||
renames STBE.PC_For;
|
||||
-- Returns the code address held by a given traceback entry, typically the
|
||||
|
@ -516,7 +516,7 @@ __gnat_to_os_time (OS_Time *p_time, int year, int month, int day,
|
||||
v.tm_hour = hours;
|
||||
v.tm_min = mins;
|
||||
v.tm_sec = secs;
|
||||
v.tm_isdst = 0;
|
||||
v.tm_isdst = -1;
|
||||
|
||||
/* returns -1 of failing, this is s-os_lib Invalid_Time */
|
||||
|
||||
|
@ -5415,7 +5415,7 @@ work as expected. Names of discriminants and components in records are
|
||||
not included in this check.
|
||||
|
||||
@item -gnatw.K
|
||||
@emph{Suppress warnings on variables that could be constants.}
|
||||
@emph{Suppress warnings on redefinition of names in standard.}
|
||||
@cindex @option{-gnatwK} (@command{gcc})
|
||||
This switch activates warnings for declarations that declare a name that
|
||||
is defined in package Standard.
|
||||
|
@ -3834,8 +3834,12 @@ package body Inline is
|
||||
-- call will pass the parameter by reference, and thus the inlined
|
||||
-- code will have the same semantics.
|
||||
|
||||
-- Finally, we need a renaming declaration in the case of limited
|
||||
-- types for which initialization cannot be by copy either.
|
||||
|
||||
if Ekind (F) = E_In_Parameter
|
||||
and then not Is_By_Reference_Type (Etype (A))
|
||||
and then not Is_Limited_Type (Etype (A))
|
||||
and then
|
||||
(not Is_Array_Type (Etype (A))
|
||||
or else not Is_Object_Reference (A)
|
||||
|
@ -111,6 +111,7 @@ package body Sem_Aggr is
|
||||
-- Check that Expr is either not limited or else is one of the cases of
|
||||
-- expressions allowed for a limited component association (namely, an
|
||||
-- aggregate, function call, or <> notation). Report error for violations.
|
||||
-- Expression is also OK in an instance or inlining context.
|
||||
|
||||
procedure Check_Qualified_Aggregate (Level : Nat; Expr : Node_Id);
|
||||
-- Given aggregate Expr, check that sub-aggregates of Expr that are nested
|
||||
@ -687,10 +688,13 @@ package body Sem_Aggr is
|
||||
begin
|
||||
if Is_Limited_Type (Etype (Expr))
|
||||
and then Comes_From_Source (Expr)
|
||||
and then not In_Instance_Body
|
||||
then
|
||||
if not OK_For_Limited_Init (Etype (Expr), Expr) then
|
||||
Error_Msg_N ("initialization not allowed for limited types", Expr);
|
||||
if In_Instance_Body or else In_Inlined_Body then
|
||||
null;
|
||||
|
||||
elsif not OK_For_Limited_Init (Etype (Expr), Expr) then
|
||||
Error_Msg_N
|
||||
("initialization not allowed for limited types", Expr);
|
||||
Explain_Limited_Type (Etype (Expr), Expr);
|
||||
end if;
|
||||
end if;
|
||||
|
@ -4934,9 +4934,9 @@ package body Sem_Ch4 is
|
||||
-- error message. Conversely, constant-folding in the generic may
|
||||
-- transform the argument of a conversion into a string literal, which
|
||||
-- is legal. Therefore the following tests are not performed in an
|
||||
-- instance.
|
||||
-- instance. The same applies to an inlined body.
|
||||
|
||||
elsif In_Instance then
|
||||
elsif In_Instance or In_Inlined_Body then
|
||||
return;
|
||||
|
||||
elsif Nkind (Expr) = N_Null then
|
||||
|
@ -10680,6 +10680,20 @@ package body Sem_Res is
|
||||
-- Resolve operand using its own type
|
||||
|
||||
Resolve (Operand, Opnd_Type);
|
||||
|
||||
-- In an inlined context, the unchecked conversion may be applied
|
||||
-- to a literal, in which case its type is the type of the context.
|
||||
-- (In other contexts conversions cannot apply to literals).
|
||||
|
||||
if In_Inlined_Body
|
||||
and then
|
||||
(Opnd_Type = Any_Character or else
|
||||
Opnd_Type = Any_Integer or else
|
||||
Opnd_Type = Any_Real)
|
||||
then
|
||||
Set_Etype (Operand, Typ);
|
||||
end if;
|
||||
|
||||
Analyze_Dimension (N);
|
||||
Eval_Unchecked_Conversion (N);
|
||||
end Resolve_Unchecked_Type_Conversion;
|
||||
|
@ -17254,7 +17254,11 @@ package body Sem_Util is
|
||||
-- Similarly, full and partial views may be incorrect in the instance.
|
||||
-- There is no simple way to insure that it is consistent ???
|
||||
|
||||
elsif In_Instance then
|
||||
-- A similar view discrepancy can happen in an inlined body, for the
|
||||
-- same reason: inserted body may be outside of the original package
|
||||
-- and only partial views are visible at the point of insertion.
|
||||
|
||||
elsif In_Instance or else In_Inlined_Body then
|
||||
if Etype (Etype (Expr)) = Etype (Expected_Type)
|
||||
and then
|
||||
(Has_Private_Declaration (Expected_Type)
|
||||
@ -17262,6 +17266,17 @@ package body Sem_Util is
|
||||
and then No (Parent (Expected_Type))
|
||||
then
|
||||
return;
|
||||
|
||||
elsif Nkind (Parent (Expr)) = N_Qualified_Expression
|
||||
and then Entity (Subtype_Mark (Parent (Expr))) = Expected_Type
|
||||
then
|
||||
return;
|
||||
|
||||
elsif Is_Private_Type (Expected_Type)
|
||||
and then Present (Full_View (Expected_Type))
|
||||
and then Covers (Full_View (Expected_Type), Etype (Expr))
|
||||
then
|
||||
return;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user