aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 15:17:07 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 15:17:07 +0200
commit08988ed947922e00ee6d0c0ecb9a6de01cdc7238 (patch)
tree97f38666666d88b403845139074482f4255266f7 /gcc/ada
parentde6a560804ad384b70a8697fcba8d0dc632e3382 (diff)
downloadgcc-08988ed947922e00ee6d0c0ecb9a6de01cdc7238.zip
gcc-08988ed947922e00ee6d0c0ecb9a6de01cdc7238.tar.gz
gcc-08988ed947922e00ee6d0c0ecb9a6de01cdc7238.tar.bz2
[multiple changes]
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
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog32
-rw-r--r--gcc/ada/gnat_ugn.texi3
-rw-r--r--gcc/ada/par-ch6.adb3
-rw-r--r--gcc/ada/restrict.adb23
-rw-r--r--gcc/ada/sem_ch11.adb9
-rw-r--r--gcc/ada/sem_ch13.adb3
-rw-r--r--gcc/ada/sem_ch3.adb4
-rw-r--r--gcc/ada/sem_ch4.adb4
-rw-r--r--gcc/ada/sem_ch5.adb6
9 files changed, 74 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 0f2ae31..434a072 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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,
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index c82dab7..2b50495 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -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
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index f060b3f..560cf4c 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -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;
diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb
index ea0f89c..668c444 100644
--- a/gcc/ada/restrict.adb
+++ b/gcc/ada/restrict.adb
@@ -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
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index 180ecc6..c5b92e2 100644
--- a/gcc/ada/sem_ch11.adb
+++ b/gcc/ada/sem_ch11.adb
@@ -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);
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 0b812a7..b059b13 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -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++??",
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 5e40656..0d3cd0f 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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);
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index bf19a38..06a548a 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -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);
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index e7f464e..a29aece 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -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))