diff mbox series

[Ada] Fix code quality issues reported by CodePeer at level 3

Message ID 20171109121044.GA31459@adacore.com
State New
Headers show
Series [Ada] Fix code quality issues reported by CodePeer at level 3 | expand

Commit Message

Pierre-Marie de Rodat Nov. 9, 2017, 12:10 p.m. UTC
Rerunning CodePeer at level 3 revealed further missing
initializations (not errors, but good to add for maintenance and
to improve analysis results) and missing No_Return pragmas. Now fixed.

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-11-09  Yannick Moy  <moy@adacore.com>

	* sem_attr.adb (Analyze_Attribute): Default initialize P_Type,
	P_Base_Type.
	(Error_Attr_P): Fix name in pragma No_Return.
	(Unexpected_Argument): Add pragma No_Return.
	(Placement_Error): Add pragma No_Return.
diff mbox series

Patch

Index: sem_attr.adb
===================================================================
--- sem_attr.adb	(revision 254563)
+++ sem_attr.adb	(working copy)
@@ -231,10 +231,10 @@ 
       E1      : Node_Id;
       E2      : Node_Id;
 
-      P_Type : Entity_Id;
+      P_Type : Entity_Id := Empty;
       --  Type of prefix after analysis
 
-      P_Base_Type : Entity_Id;
+      P_Base_Type : Entity_Id := Empty;
       --  Base type of prefix after analysis
 
       -----------------------
@@ -419,7 +419,7 @@ 
       --  required error messages.
 
       procedure Error_Attr_P (Msg : String);
-      pragma No_Return (Error_Attr);
+      pragma No_Return (Error_Attr_P);
       --  Like Error_Attr, but error is posted at the start of the prefix
 
       procedure Legal_Formal_Attribute;
@@ -446,7 +446,9 @@ 
       --  node in the aspect case).
 
       procedure Unexpected_Argument (En : Node_Id);
-      --  Signal unexpected attribute argument (En is the argument)
+      pragma No_Return (Unexpected_Argument);
+      --  Signal unexpected attribute argument (En is the argument), and then
+      --  raises Bad_Attribute to avoid any further semantic processing.
 
       procedure Validate_Non_Static_Attribute_Function_Call;
       --  Called when processing an attribute that is a function call to a
@@ -1108,8 +1110,10 @@ 
          --  node Nod is within enclosing node Encl_Nod.
 
          procedure Placement_Error;
+         pragma No_Return (Placement_Error);
          --  Emit a general error when the attributes does not appear in a
-         --  postcondition-like aspect or pragma.
+         --  postcondition-like aspect or pragma, and then raises Bad_Attribute
+         --  to avoid any further semantic processing.
 
          ------------------------------
          -- Check_Placement_In_Check --