1-- This file gives the AdaControl equivalents of rules checked by Gnatcheck 2-- For rules where Gnatcheck requires a parameter, the AdaControl rule is given for 3-- the default value, or with an example value. 4-- 5-- Small differences are indicated by a comment that starts with "Difference:" 6-- 7 8Abstract_Type_Declarations: 9 check declarations (abstract_type); 10 11Annotated_Comments: -- example for "CMarker" 12 check comments (Pattern, "^C[ \t]*Marker"); 13 14Anonymous_Arrays: 15 check declarations (single_array); 16 17Anonymous_Subtypes: 18 check declarations (anonymous_subtype_allocator, anonymous_subtype_case, 19 anonymous_subtype_declaration, anonymous_subtype_for, 20 anonymous_subtype_indexing); 21 22Blocks: 23 check statements (block); 24 25Boolean_Relational_Operators: 26 check entities (standard."=" {standard.Boolean; standard.boolean return standard.boolean}, 27 standard."/="{standard.Boolean; standard.boolean return standard.boolean}, 28 standard."<" {standard.Boolean; standard.boolean return standard.boolean}, 29 standard."<="{standard.Boolean; standard.boolean return standard.boolean}, 30 standard.">" {standard.Boolean; standard.boolean return standard.boolean}, 31 standard.">="{standard.Boolean; standard.boolean return standard.boolean} 32 ); 33 34Controlled_Type_Declarations: 35 check declarations (controlled_type); 36 37Declarations_In_Blocks: 38 check statements (effective_declare_block); 39 40"Deeply_Nested_Generics:2": 41 check max_nesting (generic, 2); 42 43Default_Parameters: 44 check declarations (defaulted_parameter); 45 46Discriminated_Records: 47 check declarations (discriminant); 48 -- Difference: includes also task and protected discriminants 49 50Enumeration_Ranges_In_CASE_Statements: 51 check case_statement (range_span, max 0); 52 -- Difference: includes also integer ranges, does not include null ranges 53 54Exceptions_As_Control_Flow: 55 check statements (raise_locally_handled); 56 -- Difference: AdaControl handles correctly package bodies, tasks, and accepts 57 58Exits_From_Conditional_Loops: 59 check statements (exit_for_loop, exit_while_loop); 60 -- Difference: AdaControl checks only exits that refer to the given kind of loop 61 -- check statements (exit_outer_loop) can be used to check for exit of several levels of loops 62 63EXIT_Statements_With_No_Loop_Name: 64 check statements (unnamed_exit); 65 -- Difference: applies only to named loops 66 67Expanded_Loop_Exit_Names: 68 check statements (exit_expanded_name); 69 70Explicit_Full_Discrete_Ranges: 71 check simplifiable_expressions (range); 72 73Float_Equality_Checks: 74 check expressions (real_equality); 75 -- Difference: applies also to fixed points 76 77"Forbidden_Attributes:all": 78 check entities (all 'all); 79--"Forbidden_Attributes:gnat": 80 source no_gnat_attribute; 81"Forbidden_Attributes:Digits": -- Example of a specific attribute 82 check entities (all 'Digits); 83 84"Forbidden_Pragmas:all": 85 check pragmas (all); 86"Forbidden_Pragmas:gnat": 87 check pragmas (nonstandard); 88 -- Difference: applies to all non-standard pragmas, not only Gnat ones 89"Forbidden_Pragmas:elaborate": -- Example of a specific pragma 90 check pragmas (Elaborate); 91 92Function_Style_Procedures: 93 check parameter_declarations (single_out_parameter, procedure); 94 -- Difference: applies also to limited out parameters and null procedures 95 96Generics_In_Subprograms: 97 check declarations (local generic); 98 99GOTO_Statements: 100 check statements(goto); 101 102Implicit_IN_Mode_Parameters: 103 check style (default_in); 104 105Implicit_SMALL_For_Fixed_Point_Types: 106 check declarations (ordinary_fixed_type_no_small); 107 108Improperly_Located_Instantiations: 109 check declarations (public instantiation), 110 check declarations (private instantiation), 111 check declarations (local instantiation); 112 113Improper_Returns: 114 check statements (procedure_return, function_return); 115 -- Difference: AdaControl allows one return in each exception handler 116 117Library_Level_Subprograms: 118 check declarations (library procedure, library function); 119 120Local_Packages: 121 check declarations (private package), 122 check declarations (public package); 123 124"Metrics_LSLOC:1000": 125 check max_size (unit, 1000); 126 127Misnamed_Identifiers: 128 check naming_convention (type, "_T$"), 129 check naming_convention (root access_type, "_A$"), 130 check naming_convention (regular_constant, "_C$"), 131 check naming_convention (package_renaming, "_R$"); 132 133Multiple_Entries_In_Protected_Definitions: 134 check declarations (multiple_protected_entries); 135 136Name_Clashes: 137 check naming_convention (all, not "example"); 138 -- replace "example" by the prohibited identifiers 139 140Non_Qualified_Aggregates: 141 check expressions (unqualified_aggregate); 142 143Non_Short_Circuit_Operators: 144 check expressions (and, or); 145 146Non_SPARK_Attributes: check entities (all 'Access, 147 all 'Address, 148 all 'Alignment, 149 all 'Bit_Order, 150 all 'Body_Version, 151 all 'Callable, 152 all 'Caller, 153 all 'Class, 154 all 'Constrained, 155 all 'Count, 156 all 'Definite, 157 all 'External_Tag, 158 all 'First_Bit, 159 all 'Identity, 160 all 'Image, 161 all 'Input, 162 all 'Last_Bit, 163 all 'Max_Size_In_Storage_Elements, 164 all 'Output, 165 all 'Partition_ID, 166 all 'Position, 167 all 'Read, 168 all 'Round, 169 all 'Scale, 170 all 'Scaling, 171 all 'Storage_Pool, 172 all 'Storage_Size, 173 all 'Tag, 174 all 'Terminated, 175 all 'Unchecked_Access, 176 all 'Value, 177 all 'Version, 178 all 'Wide_Image, 179 all 'Wide_Value, 180 all 'Wide_Width, 181 all 'Width, 182 all 'Write); 183 184Non_Tagged_Derived_Types: 185 check declarations (derived_type); 186 187Non_Visible_Exceptions: 188 check exception_propagation (local_exception); 189 190"Numeric_Literals:10": 191 check style (exposed_literal, integer, max 10, number, constant), 192 check style (exposed_literal, real, number, constant); 193 -- For "statements_only", replace "number, constant" with "declaration" above 194 195OTHERS_In_Aggregates: 196 check expressions (array_partial_others, record_partial_others); 197 -- Difference: does not special case when others refer to all-but-one component 198 199OTHERS_In_CASE_Statements: 200 check statements (case_others); 201 202OTHERS_In_Exception_Handlers: 203 check statements (exception_others); 204 205Outer_Loop_Exits: 206 check statements (exit_outer_loop); 207 208Overloaded_Operators: 209 check declarations (operator); 210 -- Difference: controls all operators; gnatcheck says operator overloading 211 212Overly_Nested_Control_Structures: 213 check max_statement_nesting (all, 4); 214 215Parameters_Out_Of_Order: 216 check style (parameter_order, in | access, in_out, out, defaulted_in); 217 218Positional_Actuals_For_Defaulted_Generic_Parameters: 219 check default_parameter (instantiations, all, positional); 220 221Positional_Actuals_For_Defaulted_Parameters: 222 check default_parameter (calls, all, positional); 223 224Positional_Components: 225 check positional_associations(all, 0, array_aggregate), 226 check positional_associations(all, 0, record_aggregate); 227 228Positional_Generic_Parameters: 229 check positional_associations(all, 0, instantiation); 230 231Positional_Parameters: 232 check positional_associations(all, 1, call); 233 234Predefined_Numeric_Types: 235 check entities (Standard.Short_Short_Integer, Standard.Short_Integer, Standard.Integer, 236 Standard.Long_Integer, Standard.Long_Long_Integer, 237 Standard.Natural, Standard.Positive, 238 Standard.Short_Float, Standard.Float, Standard.Long_Float, Standard.Long_Long_Float, 239 Standard.Duration); 240 241Raising_External_Exceptions: 242 check statements (raise_nonpublic); 243 244Raising_Predefined_Exceptions: 245 check statements (raise_standard); 246 247Recursive_Subprograms: 248 check Max_Call_Depth (Finite); 249 250Separate_Numeric_Error_Handlers: 251 check declarations (non_joint_CE_NE_handler); 252 253Slices: 254 check expressions (slice); 255 256"Too_Many_Parents:5": 257 check derivations (Max_Parents, 5); 258 259Unassigned_OUT_Parameters: 260 check improper_initialization (out_parameter); 261 -- Difference: this rule may require a stricter pattern than gnatcheck 262 263Uncommented_BEGIN_In_Package_Bodies: 264 check comments (unnamed_begin, declaration package); 265 -- difference: we do not require the begin to be alone on its line 266 -- (better checked by other rules) 267 268Unconditional_Exits: 269 check statements (unconditional_exit); 270 271Unconstrained_Array_Returns: 272 check return_type (unconstrained_array); 273 274Universal_Ranges: 275 check expressions (universal_range); 276 277Unnamed_Blocks_And_Loops: 278 check statements (unnamed_block, unnamed_for_loop, unnamed_simple_loop, unnamed_while_loop); 279 280USE_PACKAGE_Clauses: 281 check use_clauses; 282 283Visible_Components: 284 check declarations (public record_type, public extension); 285 286Volatile_Objects_Without_Address_Clauses: 287 check object_declarations (volatile_no_address); 288