]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 10 Oct 2013 13:17:07 +0000 (15:17 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 10 Oct 2013 13:17:07 +0000 (15:17 +0200)
2013-10-10  Robert Dewar  <dewar@adacore.com>

* par-ch6.adb (Check_Junk_Semicolon_Before_Return): Remove
junk code.

2013-10-10  Javier Miranda  <miranda@adacore.com>

* sem_ch13.adb (Freeze_Entity_Checks): Avoid
loosing errors on CPP entities in -gnatc mode.

2013-10-10  Robert Dewar  <dewar@adacore.com>

* sem_ch5.adb (Analyze_If_Statement): Only diagnose redundant
if from source.

2013-10-10  Robert Dewar  <dewar@adacore.com>

* restrict.adb (Check_SPARK_Restriction): Refine test (don't
automatically go to the original node).
* sem_ch11.adb (Analyze_Raise_Statement): Only raise
statements that come from source violate SPARK restrictions.
(Analyze_Raise_xxx_Error): Same fix.
* sem_ch3.adb (Analyze_Object_Declaration): Check OK SPARK
initialization on original node, not on possibly rewritten
expression.
* sem_ch4.adb (Analyze_If_Expression): Only if expressions that
come from source violate SPARK mode restrictions.

2013-10-10  Robert Dewar  <dewar@adacore.com>

* gnat_ugn.texi: Fix confusing documentation for -gnatyM.

From-SVN: r203374

gcc/ada/ChangeLog
gcc/ada/gnat_ugn.texi
gcc/ada/par-ch6.adb
gcc/ada/restrict.adb
gcc/ada/sem_ch11.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_ch5.adb

index 0f2ae317a26e673e64a71efbc077c0c90d9d49ae..434a0723a8f53bd4961e54ed74d801f03f80bee0 100644 (file)
@@ -1,3 +1,35 @@
+2013-10-10  Robert Dewar  <dewar@adacore.com>
+
+       * par-ch6.adb (Check_Junk_Semicolon_Before_Return): Remove
+       junk code.
+
+2013-10-10  Javier Miranda  <miranda@adacore.com>
+
+       * sem_ch13.adb (Freeze_Entity_Checks): Avoid
+       loosing errors on CPP entities in -gnatc mode.
+
+2013-10-10  Robert Dewar  <dewar@adacore.com>
+
+       * sem_ch5.adb (Analyze_If_Statement): Only diagnose redundant
+       if from source.
+
+2013-10-10  Robert Dewar  <dewar@adacore.com>
+
+       * restrict.adb (Check_SPARK_Restriction): Refine test (don't
+       automatically go to the original node).
+       * sem_ch11.adb (Analyze_Raise_Statement): Only raise
+       statements that come from source violate SPARK restrictions.
+       (Analyze_Raise_xxx_Error): Same fix.
+       * sem_ch3.adb (Analyze_Object_Declaration): Check OK SPARK
+       initialization on original node, not on possibly rewritten
+       expression.
+       * sem_ch4.adb (Analyze_If_Expression): Only if expressions that
+       come from source violate SPARK mode restrictions.
+
+2013-10-10  Robert Dewar  <dewar@adacore.com>
+
+       * gnat_ugn.texi: Fix confusing documentation for -gnatyM.
+
 2013-10-10  Yannick Moy  <moy@adacore.com>
 
        * errout.adb (Compilation_Errors): In formal verification mode,
index c82dab7aa04d4ddbdb30c0836148073c1a24299f..2b5049573109d8e135dcacefca3557a4bd1457c4 100644 (file)
@@ -19032,7 +19032,8 @@ by @command{gnatstub} to compile an argument source file.
 
 @item ^-gnatyM^/MAX_LINE_LENGTH=^@var{n}
 @cindex @option{^-gnatyM^/MAX_LINE_LENGTH^} (@command{gnatstub})
-(@var{n} is a non-negative integer). Set the maximum line length in the
+(@var{n} is a non-negative integer). Set the maximum line length that is
+allowed in a source file. The default is 79. The maximum value that can be
 body stub to @var{n}; the default is 79. The maximum value that can be
 specified is 32767. Note that in the special case of configuration
 pragma files, the maximum is always 32767 regardless of whether or
index f060b3f282227aa997cc7128915c004d781b4c0a..560cf4c989c5e28ff8f581a95e20c13d01f7eedf 100644 (file)
@@ -73,9 +73,6 @@ package body Ch6 is
          else
             Restore_Scan_State (Scan_State);
          end if;
-
-      elsif Bad_Spelling_Of (Tok_Return) then
-         null;
       end if;
    end Check_Junk_Semicolon_Before_Return;
 
index ea0f89c43bce2555916eca052c27984439265f0f..668c4440d8d52a3b5c57ee49d5b6e5d009fbe911 100644 (file)
@@ -1406,9 +1406,30 @@ package body Restrict is
    is
       Msg_Issued          : Boolean;
       Save_Error_Msg_Sloc : Source_Ptr;
+      Onode               : constant Node_Id := Original_Node (N);
 
    begin
-      if Force or else Comes_From_Source (Original_Node (N)) then
+      --  Output message if Force set
+
+      if Force
+
+        --  Or if this node comes from source
+
+        or else Comes_From_Source (N)
+
+        --  Or if this is a range node which rewrites a range attribute and
+        --  the range attribute comes from source.
+
+        or else (Nkind (N) = N_Range
+                  and then Nkind (Onode) = N_Attribute_Reference
+                  and then Attribute_Name (Onode) = Name_Range
+                  and then Comes_From_Source (Onode))
+
+        --  Or this is an expression that does not come from source, which is
+        --  a rewriting of an expression that does come from source.
+
+        or else (Nkind (N) in N_Subexpr and then Comes_From_Source (Onode))
+      then
          if Restriction_Check_Required (SPARK_05)
            and then Is_In_Hidden_Part_In_SPARK (Sloc (N))
          then
index 180ecc6ca0b23a07d44ced0ec257a3df811d4b3f..c5b92e202c73f5cc34215159042bed5d6652a361 100644 (file)
@@ -489,7 +489,10 @@ package body Sem_Ch11 is
       Par            : Node_Id;
 
    begin
-      Check_SPARK_Restriction ("raise statement is not allowed", N);
+      if Comes_From_Source (N) then
+         Check_SPARK_Restriction ("raise statement is not allowed", N);
+      end if;
+
       Check_Unreachable_Code (N);
 
       --  Check exception restrictions on the original source
@@ -687,7 +690,9 @@ package body Sem_Ch11 is
    --  Start of processing for Analyze_Raise_xxx_Error
 
    begin
-      Check_SPARK_Restriction ("raise statement is not allowed", N);
+      if Nkind (Original_Node (N)) = N_Raise_Statement then
+         Check_SPARK_Restriction ("raise statement is not allowed", N);
+      end if;
 
       if No (Etype (N)) then
          Set_Etype (N, Standard_Void_Type);
index 0b812a73f63d0438b8acfb2ec9e9d840dd75a793..b059b135587a98d9eb41dfee0552da9a5e8f79b4 100644 (file)
@@ -8972,7 +8972,6 @@ package body Sem_Ch13 is
         and then Is_CPP_Class (E)
         and then Is_Tagged_Type (E)
         and then Tagged_Type_Expansion
-        and then Expander_Active       -- why? losing errors in -gnatc mode???
       then
          if CPP_Num_Prims (E) = 0 then
 
@@ -8981,8 +8980,6 @@ package body Sem_Ch13 is
             --  has no primitives then the C++ compiler does not added the _tag
             --  component to the type.
 
-            pragma Assert (Chars (First_Entity (E)) = Name_uTag);
-
             if First_Entity (E) /= Last_Entity (E) then
                Error_Msg_N
                  ("'C'P'P type must import at least one primitive from C++??",
index 5e40656e76b037d00337c8a7002b42aae29c87dc..0d3cd0f68c8aab1a93a96bacd8053b8eda81add7 100644 (file)
@@ -3263,7 +3263,7 @@ package body Sem_Ch3 is
             end if;
          end if;
 
-         --  Check incorrect use of dynamically tagged expressions.
+         --  Check incorrect use of dynamically tagged expressions
 
          if Is_Tagged_Type (T) then
             Check_Dynamically_Tagged_Expression
@@ -3281,7 +3281,7 @@ package body Sem_Ch3 is
            --  Only call test if needed
 
            and then Restriction_Check_Required (SPARK_05)
-           and then not Is_SPARK_Initialization_Expr (E)
+           and then not Is_SPARK_Initialization_Expr (Original_Node (E))
          then
             Check_SPARK_Restriction
               ("initialization expression is not appropriate", E);
index bf19a3866db727988998bb7799821cd3b6835114..06a548a4b7cfb25626f39cd130d3dd17ceefc2a9 100644 (file)
@@ -2033,7 +2033,9 @@ package body Sem_Ch4 is
          return;
       end if;
 
-      Check_SPARK_Restriction ("if expression is not allowed", N);
+      if Comes_From_Source (N) then
+         Check_SPARK_Restriction ("if expression is not allowed", N);
+      end if;
 
       Else_Expr := Next (Then_Expr);
 
index e7f464ee1718f20f71887f56c0ee59c5d5d720ad..a29aece272c84efbd2ef7e9b4efeecf945d8172b 100644 (file)
@@ -1580,8 +1580,14 @@ package body Sem_Ch5 is
 
       --  Warn on redundant if statement that has no effect
 
+      --  Note, we could also check empty ELSIF parts ???
+
       if Warn_On_Redundant_Constructs
 
+        --  If statement must be from source
+
+        and then Comes_From_Source (N)
+
         --  Condition must not have obvious side effect
 
         and then Has_No_Obvious_Side_Effects (Condition (N))