+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,
@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
else
Restore_Scan_State (Scan_State);
end if;
-
- elsif Bad_Spelling_Of (Tok_Return) then
- null;
end if;
end Check_Junk_Semicolon_Before_Return;
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
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
-- 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);
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
-- 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++??",
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
-- 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);
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);
-- 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))