[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 30 Jul 2014 12:56:13 +0000 (14:56 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 30 Jul 2014 12:56:13 +0000 (14:56 +0200)
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

gcc/ada/ChangeLog
gcc/ada/a-exctra.ads
gcc/ada/adaint.c
gcc/ada/gnat_ugn.texi
gcc/ada/inline.adb
gcc/ada/sem_aggr.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb

index 0b04cd7417412026653373d928534329423335f9..2f3bd34d8b9dc68df9d2320ad01eed1e0cd7dad6 100644 (file)
@@ -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
index af1d59b9658239b7340c553e06228a7aab238a77..664bd75221f1aa907e3ca9b56b850b5159a147fc 100644 (file)
@@ -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
index a84f4a5f474fba879637e64cab4ab66c163ba85c..96dedfeb447ddcebf276063353ea60525be0a515 100644 (file)
@@ -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 */
 
index af2c27565101248633d97c84cbf50207b01abe3a..cc1f7fd47b163df898d44d63ce1a307063162fc0 100644 (file)
@@ -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.
index b9d0d8e27229e14e6474a864a5c8697d848ddf33..86704dc052a4b109e308d6899c810904f96d961a 100644 (file)
@@ -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)
index 157b20241490242dfa1f733a8ad4e60d1aef7369..3e71ebe0de520c106a63aa8023d0be4ead46e9f7 100644 (file)
@@ -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;
index f7d6aa895b64e1fa306e916bb23b30277cc1c253..b78b06a05e049325d778657dd72e73e5c17ef67f 100644 (file)
@@ -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
index 332bc6090c7677b5eb51c787a45433a974c57e34..52b717e0593df5ce16cafe5a8b1d2460fc4820c0 100644 (file)
@@ -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;
index 916942a6bd06df860ec04b6a6cc76a8e1cf50406..5aa63a9558596ea441cf242639c3b1c4cdc54f30 100644 (file)
@@ -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;