[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
This commit is contained in:
Arnaud Charlet 2013-10-10 15:17:07 +02:00
parent de6a560804
commit 08988ed947
9 changed files with 74 additions and 13 deletions

View 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,

View 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

View 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;

View 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

View 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);

View 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++??",

View 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);

View 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);

View 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))