001/*-------------------------------------------------------------------------+ 002| | 003| Copyright (c) 2009-2019 CQSE GmbH | 004| | 005+-------------------------------------------------------------------------*/ 006package eu.cqse.check.framework.core.ruleset; 007 008import java.util.function.BiConsumer; 009 010/** 011 * Enumeration of all rules of the Autosar C++ 14 standard. 012 * 013 * Most of this class has been auto-generated from the guideline using 014 * "pdftotext" and a script located at 015 * "https://intra.cqse.eu/svn/customers/bmw/2018_teamscale-checks/quote/extract.pl". 016 */ 017public enum EAutosarCpp14Rule implements IRulesetRule { 018 // required, implementation, automated 019 M0_1_1("M0-1-1", "A project shall not contain unreachable code."), 020 021 // required, implementation, automated 022 M0_1_2("M0-1-2", "A project shall not contain infeasible paths."), 023 024 // required, implementation, automated 025 M0_1_3("M0-1-3", "A project shall not contain unused variables."), 026 027 // required, implementation, automated 028 M0_1_4("M0-1-4", "A project shall not contain non-volatile POD variables having only one use."), 029 030 // required, implementation, automated 031 M0_1_5("M0-1-5", "A project shall not contain unused type declarations."), 032 033 // required, implementation, automated 034 A0_1_1("A0-1-1", 035 "A project shall not contain instances of non-volatile variables being given values that are not subsequently used."), 036 037 // required, implementation, automated 038 A0_1_2("A0-1-2", 039 "The value returned by a function having a non-void return type that is not an overloaded operator shall be used."), 040 041 // required, implementation, automated 042 M0_1_8("M0-1-8", "All functions with void return type shall have external side effect(s)."), 043 044 // required, implementation, automated 045 M0_1_9("M0-1-9", "There shall be no dead code."), 046 047 // advisory, implementation, automated 048 M0_1_10("M0-1-10", "Every defined function should be called at least once."), 049 050 // required, implementation, automated 051 A0_1_3("A0-1-3", "Every static function or private method of a class shall be used."), 052 053 // required, implementation, automated 054 M0_1_11("M0-1-11", "There shall be no unused parameters (named or unnamed) in non-virtual functions."), 055 056 // required, implementation, automated 057 M0_1_12("M0-1-12", 058 "There shall be no unused parameters (named or unnamed) in the set of parameters for a virtual function and all the functions that override it."), 059 060 // required, implementation, automated 061 M0_2_1("M0-2-1", "An object shall not be assigned to an overlapping object."), 062 063 // required, implementation/verification, non-automated 064 M0_3_1("M0-3-1", 065 "Minimization of run-time failures shall be ensured by the use of at least one of: (a) static analysis tools/techniques; (b) dynamic analysis tools/techniques; (c) explicit coding of checks to handle run-time faults."), 066 067 // required, implementation, non-automated 068 M0_3_2("M0-3-2", "If a function generates error information, then that error information shall be tested."), 069 070 // required, implementation, non-automated 071 M0_4_1("M0-4-1", "Use of scaled-integer or fixed-point arithmetic shall be documented."), 072 073 // required, implementation, non-automated 074 M0_4_2("M0-4-2", "Use of floating-point arithmetic shall be documented."), 075 076 // required, infrastructure/toolchain, non-automated 077 A0_4_1("A0-4-1", "Floating-point implementation shall comply with IEEE 754 standard."), 078 079 // required, implementation, automated 080 A0_4_2("A0-4-2", "Type long double shall not be used."), 081 082 // required, toolchain, automated 083 A0_4_3("A0-4-3", 084 "The implementations in the chosen compiler shall strictly comply with the C++14 Language Standard."), 085 086 // required, implementation, automated 087 A1_1_1("A1-1-1", 088 "All code shall conform to ISO/IEC 14882:2014 - Programming Language C++ and shall not use deprecated features."), 089 090 // required, implementation, non-automated 091 M1_0_2("M1-0-2", "Multiple compilers shall only be used if they have a common, defined interface."), 092 093 // required, toolchain, non-automated 094 A1_1_2("A1-1-2", "A warning level of the compilation process shall be set in compliance with project policies."), 095 096 // required, implementation, automated 097 A1_1_3("A1-1-3", 098 "An optimization option that disregards strict standard compliance shall not be turned on in the chosen compiler."), 099 100 // required, implementation, non-automated 101 A1_2_1("A1-2-1", 102 "When using a compiler toolchain (including preprocessor, compiler itself, linker, C++ standard libraries) in safety-related software, the tool confidence level (TCL) shall be determined. In case of TCL2 or TCL3, the compiler shall undergo a \"Qualification of a software tool\", as per ISO 26262-8.11.4.6 [5]."), 103 104 // required, implementation, non-automated 105 A1_4_1("A1-4-1", "Code metrics and their valid boundaries shall be defined."), 106 107 // required, implementation, non-automated 108 A1_4_2("A1-4-2", "All code shall comply with defined boundaries of code metrics."), 109 110 // required, implementation, automated 111 A2_2_1("A2-2-1", 112 "Only those characters specified in the C++ Language Standard basic source character set shall be used in the source code."), 113 114 // required, implementation, automated 115 A2_5_1("A2-5-1", "Trigraphs shall not be used."), 116 117 // required, implementation, automated 118 A2_6_1("A2-6-1", "Digraphs shall not be used."), 119 120 // required, implementation, automated 121 A2_8_1("A2-8-1", "The character \\ shall not occur as a last character of a C++ comment."), 122 123 // required, implementation, non-automated 124 A2_8_2("A2-8-2", "Sections of code shall not be \"commented out\"."), 125 126 // required, implementation, automated 127 A2_8_3("A2-8-3", 128 "All declarations of \"user-defined\" types, static and non-static data members, functions and methods shall be preceded by documentation using \"///\" comments and \"@tag\" tags."), 129 130 // required, implementation, automated 131 A2_8_4("A2-8-4", "C-style comments shall not be used."), 132 133 // required, implementation, automated 134 A2_9_1("A2-9-1", "A header file name shall be identical to a type name declared in it if it declares a type."), 135 136 // required, implementation, automated 137 M2_10_1("M2-10-1", "Different identifiers shall be typographically unambiguous."), 138 139 // required, implementation, automated 140 A2_11_1("A2-11-1", 141 "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope."), 142 143 // required, implementation, automated 144 M2_10_3("M2-10-3", "A typedef name (including qualification, if any) shall be a unique identifier."), 145 146 // required, implementation, automated 147 A2_11_2("A2-11-2", "A \"using\" name shall be a unique identifier within a namespace."), 148 149 // required, implementation, automated 150 A2_11_3("A2-11-3", "A \"user-defined\" type name shall be a unique identifier within a namespace."), 151 152 // required, implementation, automated 153 A2_11_4("A2-11-4", 154 "The identifier name of a non-member object with static storage duration or static function shall not be reused within a namespace."), 155 156 // advisory, implementation, automated 157 A2_11_5("A2-11-5", 158 "An identifier name of a non-member object or function with static storage duration should not be reused."), 159 160 // required, implementation, automated 161 M2_10_6("M2-10-6", 162 "If an identifier refers to a type, it shall not also refer to an object or a function in the same scope."), 163 164 // required, implementation, automated 165 A2_14_1("A2-14-1", "Only those escape sequences that are defined in ISO/IEC 14882:2014 shall be used."), 166 167 // required, implementation, automated 168 M2_13_2("M2-13-2", 169 "Octal constants (other than zero) and octal escape sequences (other than \"\\0\" ) shall not be used."), 170 171 // required, implementation, automated 172 M2_13_3("M2-13-3", 173 "A \"U\" suffix shall be applied to all octal or hexadecimal integer literals of unsigned type."), 174 175 // required, implementation, automated 176 M2_13_4("M2-13-4", "Literal suffixes shall be upper case."), 177 178 // required, implementation, automated 179 A2_14_2("A2-14-2", "String literals with different encoding prefixes shall not be concatenated."), 180 181 // required, implementation, automated 182 A2_14_3("A2-14-3", "Type wchar_t shall not be used."), 183 184 // required, implementation, automated 185 A3_1_1("A3-1-1", 186 "It shall be possible to include any header file in multiple translation units without violating the One Definition Rule."), 187 188 // required, implementation, automated 189 A3_1_2("A3-1-2", 190 "Header files, that are defined locally in the project, shall have a file name extension of one of: \".h\", \".hpp\" or \".hxx\"."), 191 192 // advisory, implementation, automated 193 A3_1_3("A3-1-3", 194 "Implementation files, that are defined locally in the project, should have a file name extension of \".cpp\"."), 195 196 // required, implementation, automated 197 M3_1_2("M3-1-2", "Functions shall not be declared at block scope."), 198 199 // required, implementation, automated 200 A3_1_4("A3-1-4", "When an array with external linkage is declared, its size shall be stated explicitly."), 201 202 // required, implementation, automated 203 M3_2_1("M3-2-1", "All declarations of an object or function shall have compatible types."), 204 205 // required, implementation, automated 206 M3_2_2("M3-2-2", "The One Definition Rule shall not be violated."), 207 208 // required, implementation, automated 209 M3_2_3("M3-2-3", 210 "A type, object or function that is used in multiple translation units shall be declared in one and only one file."), 211 212 // required, implementation, automated 213 M3_2_4("M3-2-4", "An identifier with external linkage shall have exactly one definition."), 214 215 // required, implementation, automated 216 A3_3_1("A3-3-1", 217 "Objects or functions with external linkage (including members of named namespaces) shall be declared in a header file."), 218 219 // required, implementation, automated 220 A3_3_2("A3-3-2", "Non-POD type objects with static storage duration shall not be used."), 221 222 // required, implementation, automated 223 M3_3_2("M3-3-2", 224 "If a function has internal linkage then all re-declarations shall include the static storage class specifier."), 225 226 // required, implementation, automated 227 M3_4_1("M3-4-1", 228 "An identifier declared to be an object or type shall be defined in a block that minimizes its visibility."), 229 230 // required, implementation, automated 231 M3_9_1("M3-9-1", 232 "The types used for an object, a function return type, or a function parameter shall be token-for-token identical in all declarations and re-declarations."), 233 234 // required, implementation, automated 235 A3_9_1("A3-9-1", 236 "Fixed width integer types from <cstdint>, indicating the size and signedness, shall be used in place of the basic numerical types."), 237 238 // required, implementation, automated 239 M3_9_3("M3-9-3", "The underlying bit representations of floating-point values shall not be used."), 240 241 // required, implementation, automated 242 M4_5_1("M4-5-1", 243 "Expressions with type bool shall not be used as operands to built-in operators other than the assignment operator =, the logical operators &&, ||, !, the equality operators == and ! =, the unary & operator, and the conditional operator."), 244 245 // required, implementation, automated 246 A4_5_1("A4-5-1", 247 "Expressions with type enum or enum class shall not be used as operands to built-in and overloaded operators other than the subscript operator [ ], the assignment operator =, the equality operators == and ! =, the unary & operator, and the relational operators <, <=, >, >=."), 248 249 // required, implementation, automated 250 M4_5_3("M4-5-3", 251 "Expressions with type (plain) char and wchar_t shall not be used as operands to built-in operators other than the assignment operator =, the equality operators == and ! =, and the unary & operator."), 252 253 // required, implementation, automated 254 A4_7_1("A4-7-1", "An integer expression shall not lead to data loss."), 255 256 // required, implementation, automated 257 M4_10_1("M4-10-1", "NULL shall not be used as an integer value."), 258 259 // required, implementation, automated 260 A4_10_1("A4-10-1", "Only nullptr literal shall be used as the null-pointer-constant."), 261 262 // required, implementation, automated 263 M4_10_2("M4-10-2", "Literal zero (0) shall not be used as the null-pointer-constant."), 264 265 // required, implementation, automated 266 A5_0_1("A5-0-1", 267 "The value of an expression shall be the same under any order of evaluation that the standard permits."), 268 269 // advisory, implementation, partially automated 270 M5_0_2("M5-0-2", "Limited dependence should be placed on C++ operator precedence rules in expressions."), 271 272 // required, implementation, automated 273 M5_0_3("M5-0-3", "A cvalue expression shall not be implicitly converted to a different underlying type."), 274 275 // required, implementation, automated 276 M5_0_4("M5-0-4", "An implicit integral conversion shall not change the signedness of the underlying type."), 277 278 // required, implementation, automated 279 M5_0_5("M5-0-5", "There shall be no implicit floating-integral conversions."), 280 281 // required, implementation, automated 282 M5_0_6("M5-0-6", 283 "An implicit integral or floating-point conversion shall not reduce the size of the underlying type."), 284 285 // required, implementation, automated 286 M5_0_7("M5-0-7", "There shall be no explicit floating-integral conversions of a cvalue expression."), 287 288 // required, implementation, automated 289 M5_0_8("M5-0-8", 290 "An explicit integral or floating-point conversion shall not increase the size of the underlying type of a cvalue expression."), 291 292 // required, implementation, automated 293 M5_0_9("M5-0-9", 294 "An explicit integral conversion shall not change the signedness of the underlying type of a cvalue expression."), 295 296 // required, implementation, automated 297 M5_0_10("M5-0-10", 298 "If the bitwise operators ~ and << are applied to an operand with an underlying type of unsigned char or unsigned short, the result shall be immediately cast to the underlying type of the operand."), 299 300 // required, implementation, automated 301 M5_0_11("M5-0-11", "The plain char type shall only be used for the storage and use of character values."), 302 303 // required, implementation, automated 304 M5_0_12("M5-0-12", 305 "Signed char and unsigned char type shall only be used for the storage and use of numeric values."), 306 307 // required, implementation, automated 308 A5_0_2("A5-0-2", 309 "The condition of an if-statement and the condition of an iteration statement shall have type bool."), 310 311 // required, implementation, automated 312 M5_0_14("M5-0-14", "The first operand of a conditional-operator shall have type bool."), 313 314 // required, implementation, automated 315 M5_0_15("M5-0-15", "Array indexing shall be the only form of pointer arithmetic."), 316 317 // required, implementation, automated 318 M5_0_16("M5-0-16", 319 "A pointer operand and any pointer resulting from pointer arithmetic using that operand shall both address elements of the same array."), 320 321 // required, implementation, automated 322 M5_0_17("M5-0-17", 323 "Subtraction between pointers shall only be applied to pointers that address elements of the same array."), 324 325 // required, implementation, automated 326 M5_0_18("M5-0-18", 327 ">, >=, <, <= shall not be applied to objects of pointer type, except where they point to the same array."), 328 329 // required, implementation, automated 330 A5_0_3("A5-0-3", "The declaration of objects shall contain no more than two levels of pointer indirection."), 331 332 // required, implementation, automated 333 M5_0_20("M5-0-20", "Non-constant operands to a binary bitwise operator shall have the same underlying type."), 334 335 // required, implementation, automated 336 M5_0_21("M5-0-21", "Bitwise operators shall only be applied to operands of unsigned underlying type."), 337 338 // required, implementation, partially automated 339 A5_1_1("A5-1-1", 340 "Literal values shall not be used apart from type initialization, otherwise symbolic names shall be used instead."), 341 342 // required, implementation, automated 343 A5_1_2("A5-1-2", "Variables shall not be implicitly captured in a lambda expression."), 344 345 // required, implementation, automated 346 A5_1_3("A5-1-3", "Parameter list (possibly empty) shall be included in every lambda expression."), 347 348 // required, implementation, automated 349 A5_1_4("A5-1-4", "A lambda expression object shall not outlive any of its reference-captured objects."), 350 351 // advisory, implementation, non-automated 352 A5_1_5("A5-1-5", 353 "If a lambda expression is used in the same scope in which it has been defined, the lambda should capture objects by reference."), 354 355 // advisory, implementation, automated 356 A5_1_6("A5-1-6", "Return type of a non-void return type lambda expression should be explicitly specified."), 357 358 // required, implementation, automated 359 A5_1_7("A5-1-7", "The underlying type of lambda expression shall not be used."), 360 361 // advisory, implementation, automated 362 A5_1_8("A5-1-8", "Lambda expressions should not be defined inside another lambda expression."), 363 364 // required, implementation, automated 365 M5_2_1("M5-2-1", "Each operand of a logical &&, || shall be a postfix expression."), 366 367 // required, implementation, automated 368 M5_2_2("M5-2-2", 369 "A pointer to a virtual base class shall only be cast to a pointer to a derived class by means of dynamic_cast."), 370 371 // advisory, implementation, automated 372 M5_2_3("M5-2-3", "Casts from a base class to a derived class should not be performed on polymorphic types."), 373 374 // advisory, implementation, automated 375 A5_2_1("A5-2-1", "dynamic_cast should not be used."), 376 377 // required, implementation, automated 378 A5_2_2("A5-2-2", "Traditional C-style casts shall not be used."), 379 380 // required, implementation, automated 381 A5_2_3("A5-2-3", 382 "A cast shall not remove any const or volatile qualification from the type of a pointer or reference."), 383 384 // required, implementation, automated 385 M5_2_6("M5-2-6", 386 "A cast shall not convert a pointer to a function to any other pointer type, including a pointer to function type."), 387 388 // required, implementation, automated 389 A5_2_4("A5-2-4", "reinterpret_cast shall not be used."), 390 391 // required, implementation, automated 392 M5_2_8("M5-2-8", 393 "An object with integer type or pointer to void type shall not be converted to an object with pointer type."), 394 395 // required, implementation, automated 396 M5_2_9("M5-2-9", "A cast shall not convert a pointer type to an integral type."), 397 398 // required, implementation, automated 399 M5_2_10("M5-2-10", 400 "The increment (++) and decrement (−−) operators shall not be mixed with other operators in an expression."), 401 402 // required, implementation, automated 403 M5_2_11("M5-2-11", "The comma operator, && operator and the || operator shall not be overloaded."), 404 405 // required, implementation, automated 406 A5_2_5("A5-2-5", "An array shall not be accessed beyond its range."), 407 408 // required, implementation, automated 409 M5_2_12("M5-2-12", "An identifier with array type passed as a function argument shall not decay to a pointer."), 410 411 // required, implementation, automated 412 M5_3_1("M5-3-1", 413 "Each operand of the ! operator, the logical && or shall have type bool. the logical || operators"), 414 415 // required, implementation, automated 416 M5_3_2("M5-3-2", 417 "The unary minus operator shall not be applied to an expression whose underlying type is unsigned."), 418 419 // required, implementation, automated 420 M5_3_3("M5-3-3", "The unary & operator shall not be overloaded."), 421 422 // required, implementation, automated 423 M5_3_4("M5-3-4", "Evaluation of the operand to the sizeof operator shall not contain side effects."), 424 425 // required, implementation, non-automated 426 A5_3_1("A5-3-1", "Evaluation of the operand to the typeid operator shall not contain side effects."), 427 428 // required, implementation, automated 429 A5_5_1("A5-5-1", 430 "The right hand operand of the integer division or remainder operators shall not be equal to zero."), 431 432 // required, implementation, partially automated 433 M5_8_1("M5-8-1", 434 "The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left hand operand."), 435 436 // required, implementation, automated 437 A5_10_1("A5-10-1", 438 "A pointer to member virtual function shall only be tested for equality with null-pointer-constant."), 439 440 // required, implementation, automated 441 M5_14_1("M5-14-1", "The right hand operand of a logical &&, || operators shall not contain side effects."), 442 443 // required, implementation, automated 444 A5_16_1("A5-16-1", "The ternary conditional operator shall not be used as a sub-expression."), 445 446 // required, implementation, non-automated 447 M5_17_1("M5-17-1", 448 "The semantic equivalence between a binary operator and its assignment operator form shall be preserved."), 449 450 // required, implementation, automated 451 M5_18_1("M5-18-1", "The comma operator shall not be used."), 452 453 // required, implementation, automated 454 M5_19_1("M5-19-1", "Evaluation of constant unsigned integer expressions shall not lead to wraparound."), 455 456 // required, implementation, automated 457 M6_2_1("M6-2-1", "Assignment operators shall not be used in sub-expressions."), 458 459 // required, implementation, partially automated 460 M6_2_2("M6-2-2", 461 "Floating-point expressions shall not be directly or indirectly tested for equality or inequality."), 462 463 // required, implementation, automated 464 M6_2_3("M6-2-3", 465 "Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment, provided that the first character following the null statement is a white-space character."), 466 467 // required, implementation, automated 468 M6_3_1("M6-3-1", 469 "The statement forming the body of a switch, while, do ... statement shall be a compound statement. "), 470 471 // required, implementation, automated 472 M6_4_1("M6-4-1", 473 "An if ( condition ) construct shall be followed by a compound statement. The else keyword shall be followed by either a compound statement, or another if statement."), 474 475 // required, implementation, automated 476 M6_4_2("M6-4-2", "All if ... else if constructs shall be terminated with an else clause."), 477 478 // required, implementation, automated 479 M6_4_3("M6-4-3", "A switch statement shall be a well-formed switch statement."), 480 481 // required, implementation, automated 482 M6_4_4("M6-4-4", 483 "A switch-label shall only be used when the most closely-enclosing compound statement is the body of a switch statement."), 484 485 // required, implementation, automated 486 M6_4_5("M6-4-5", "An unconditional throw or break statement shall terminate every non-empty switch-clause."), 487 488 // required, implementation, automated 489 M6_4_6("M6-4-6", "The final clause of a switch statement shall be the default-clause."), 490 491 // required, implementation, automated 492 M6_4_7("M6-4-7", "The condition of a switch statement shall not have bool type."), 493 494 // required, implementation, automated 495 A6_4_1("A6-4-1", "A switch statement shall have at least two case-clauses, distinct from the default label."), 496 497 // required, implementation, automated 498 A6_5_1("A6-5-1", 499 "A for-loop that loops through all elements of the container and does not use its loop-counter shall not be used."), 500 501 // required, implementation, automated 502 A6_5_2("A6-5-2", "A for loop shall contain a single loop-counter which shall not have floatingpoint type."), 503 504 // required, implementation, automated 505 M6_5_2("M6-5-2", 506 "If loop-counter is not modified by −− or ++, then, within condition, the loopcounter shall only be used as an operand to <=, <, > or >=."), 507 508 // required, implementation, automated 509 M6_5_3("M6-5-3", "The loop-counter shall not be modified within condition or statement."), 510 511 // required, implementation, automated 512 M6_5_4("M6-5-4", 513 "The loop-counter shall be modified by one of: −−, ++, − = n, or + = n; where n remains constant for the duration of the loop."), 514 515 // required, implementation, automated 516 M6_5_5("M6-5-5", 517 "A loop-control-variable other than the loop-counter shall not be modified within condition or expression."), 518 519 // required, implementation, automated 520 M6_5_6("M6-5-6", 521 "A loop-control-variable other than the loop-counter which is modified in statement shall have type bool."), 522 523 // required, implementation, automated 524 A6_6_1("A6-6-1", "The goto statement shall not be used."), 525 526 // required, implementation, automated 527 M6_6_1("M6-6-1", 528 "Any label referenced by a goto statement shall be declared in the same block, or in a block enclosing the goto statement."), 529 530 // required, implementation, automated 531 M6_6_2("M6-6-2", "The goto statement shall jump to a label declared later in the same function body."), 532 533 // required, implementation, automated 534 M6_6_3("M6-6-3", "The continue statement shall only be used within a well-formed for loop."), 535 536 // required, implementation, automated 537 A7_1_1("A7-1-1", "Constexpr or const specifiers shall be used for immutable data declaration."), 538 539 // required, implementation, automated 540 A7_1_2("A7-1-2", "The constexpr specifier shall be used for values that can be determined at compile time."), 541 542 // required, implementation, automated 543 M7_1_2("M7-1-2", 544 "A pointer or reference parameter in a function shall be declared as pointer to const or reference to const if the corresponding object is not modified."), 545 546 // required, implementation, automated 547 A7_1_3("A7-1-3", 548 "CV-qualifiers shall be placed on the right hand side of the type that is a typedef or a using name."), 549 550 // required, implementation, automated 551 A7_1_4("A7-1-4", "The register keyword shall not be used."), 552 553 // required, implementation, automated 554 A7_1_5("A7-1-5", 555 "The auto specifier shall not be used apart from following cases: (1) to declare that a variable has the same type as return type of a function call, (2) to declare that a variable has the same type as initializer of non-fundamental type, (3) to declare parameters of a generic lambda expression, (4) to declare a function template using trailing return type syntax."), 556 557 // required, implementation, automated 558 A7_1_6("A7-1-6", "The typedef specifier shall not be used."), 559 560 // required, implementation, automated 561 A7_1_7("A7-1-7", "Each identifier shall be declared on a separate line."), 562 563 // required, implementation, automated 564 A7_1_8("A7-1-8", "A non-type specifier shall be placed before a type specifier in a declaration."), 565 566 // required, implementation, automated 567 A7_2_1("A7-2-1", 568 "An expression with enum underlying type shall only have values corresponding to the enumerators of the enumeration."), 569 570 // required, implementation, automated 571 A7_2_2("A7-2-2", "Enumeration underlying base type shall be explicitly defined."), 572 573 // required, implementation, automated 574 A7_2_3("A7-2-3", "Enumerations shall be declared as scoped enum classes."), 575 576 // required, implementation, automated 577 A7_2_4("A7-2-4", "In an enumeration, either (1) none, (2) the first or (3) all enumerators shall be initialized."), 578 579 // required, implementation, automated 580 M7_3_1("M7-3-1", 581 "The global namespace shall only contain main, namespace declarations and extern \"C\" declarations."), 582 583 // required, implementation, automated 584 M7_3_2("M7-3-2", "The identifier main shall not be used for a function other than the global function main."), 585 586 // required, implementation, automated 587 M7_3_3("M7-3-3", "There shall be no unnamed namespaces in header files."), 588 589 // required, implementation, automated 590 M7_3_4("M7-3-4", "Using-directives shall not be used."), 591 592 // required, implementation, automated 593 M7_3_5("M7-3-5", 594 "Multiple declarations for an identifier in the same namespace shall not straddle a using-declaration for that identifier."), 595 596 // required, implementation, automated 597 M7_3_6("M7-3-6", 598 "Using-directives and using-declarations (excluding class scope or function scope using-declarations) shall not be used in header files."), 599 600 // required, implementation, automated 601 A7_4_1("A7-4-1", "The asm declaration shall not be used."), 602 603 // required, implementation, non-automated 604 M7_4_1("M7-4-1", "All usage of assembler shall be documented."), 605 606 // required, implementation, automated 607 M7_4_2("M7-4-2", "Assembler instructions shall only be introduced using the asm declaration."), 608 609 // required, implementation, automated 610 M7_4_3("M7-4-3", "Assembly language shall be encapsulated and isolated."), 611 612 // required, implementation, non-automated 613 M7_5_1("M7-5-1", 614 "A function shall not return a reference or a pointer to an automatic variable (including parameters), defined within the function."), 615 616 // required, implementation, non-automated 617 M7_5_2("M7-5-2", 618 "The address of an object with automatic storage shall not be assigned to another object that may persist after the first object has ceased to exist."), 619 620 // required, implementation, automated 621 A7_5_1("A7-5-1", 622 "A function shall not return a reference or a pointer to a parameter that is passed by reference to const."), 623 624 // required, implementation, automated 625 A7_5_2("A7-5-2", "Functions shall not call themselves, either directly or indirectly."), 626 627 // required, implementation, automated 628 M8_0_1("M8-0-1", 629 "An init-declarator-list or a member-declarator-list shall consist of a single init-declarator or member-declarator respectively."), 630 631 // required, implementation, automated 632 A8_2_1("A8-2-1", 633 "When declaring function templates, the trailing return type syntax shall be used if the return type depends on the type of parameters."), 634 635 // required, implementation, automated 636 M8_3_1("M8-3-1", 637 "Parameters in an overriding virtual function shall either use the same default arguments as the function they override, or else shall not specify any default arguments."), 638 639 // required, implementation, automated 640 A8_4_1("A8-4-1", "Functions shall not be defined using the ellipsis notation."), 641 642 // required, implementation, automated 643 M8_4_2("M8-4-2", 644 "The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration."), 645 646 // required, implementation, automated 647 A8_4_2("A8-4-2", 648 "All exit paths from a function with non-void return type shall have an explicit return statement with an expression."), 649 650 // required, implementation, automated 651 M8_4_4("M8-4-4", "A function identifier shall either be used to call the function or it shall be preceded by &."), 652 653 // required, implementation, automated 654 M8_5_1("M8-5-1", "All variables shall have a defined value before they are used."), 655 656 // required, implementation, automated 657 A8_5_1("A8-5-1", 658 "In an initialization list, the order of initialization shall be following: (1) virtual base classes in depth and left to right order of the inheritance graph, (2) direct base classes in left to right order of inheritance list, (3) non-static data members in the order they were declared in the class definition."), 659 660 // required, implementation, automated 661 M8_5_2("M8-5-2", 662 "Braces shall be used to indicate and match the structure in the non-zero initialization of arrays and structures."), 663 664 // required, implementation, automated 665 A8_5_2("A8-5-2", "Braced-initialization {}, without equals sign, shall be used for variable initialization."), 666 667 // required, implementation, automated 668 A8_5_3("A8-5-3", "A variable of type auto shall not be initialized using {} or ={} bracedinitialization."), 669 670 // advisory, implementation, non-automated 671 A8_5_4("A8-5-4", 672 "A constructor taking parameter of type std::initializer_list shall only be defined in classes that internally store a collection of objects."), 673 674 // required, implementation, automated 675 M9_3_1("M9-3-1", "Const member functions shall not return non-const pointers or references to class-data."), 676 677 // required, implementation, automated 678 A9_3_1("A9-3-1", 679 "Member functions shall not return non-const \"raw\" pointers or references to private or protected data owned by the class."), 680 681 // required, implementation, automated 682 M9_3_3("M9-3-3", 683 "If a member function can be made static then it shall be made static, otherwise if it can be made const then it shall be made const."), 684 685 // required, implementation, automated 686 M9_5_1("M9-5-1", "Unions shall not be used."), 687 688 // required, implementation, non-automated 689 M9_6_1("M9-6-1", 690 "When the absolute positioning of bits representing a bit-field is required, then the behavior and packing of bit-fields shall be documented."), 691 692 // required, implementation, automated 693 A9_6_1("A9-6-1", 694 "Bit-fields shall be either unsigned integral, or enumeration (with underlying type of unsigned integral type)."), 695 696 // required, implementation, automated 697 A10_1_1("A10-1-1", "Class shall not be derived from more than one base class which is not an interface class."), 698 699 // advisory, implementation, automated 700 M10_1_1("M10-1-1", "Classes should not be derived from virtual bases."), 701 702 // required, implementation, automated 703 M10_1_2("M10-1-2", "A base class shall only be declared virtual if it is used in a diamond hierarchy."), 704 705 // required, implementation, automated 706 M10_1_3("M10-1-3", "An accessible base class shall not be both virtual and non-virtual in the same hierarchy."), 707 708 // advisory, implementation, automated 709 M10_2_1("M10-2-1", "All accessible entity names within a multiple inheritance hierarchy should be unique."), 710 711 // required, implementation, automated 712 A10_2_1("A10-2-1", "Non-virtual member functions shall not be redefined in derived classes."), 713 714 // required, implementation, automated 715 A10_3_1("A10-3-1", 716 "Virtual function declaration shall contain exactly one of the three specifiers: (1) virtual, (2) override, (3) final."), 717 718 // required, implementation, automated 719 A10_3_2("A10-3-2", "Each overriding virtual function shall be declared with the override or final specifier."), 720 721 // required, implementation, automated 722 A10_3_3("A10-3-3", "Virtual functions shall not be introduced in a final class."), 723 724 // required, implementation, automated 725 A10_3_5("A10-3-5", "A user-defined assignment operator shall not be virtual."), 726 727 // required, implementation, automated 728 M10_3_3("M10-3-3", 729 "A virtual function shall only be overridden by a pure virtual function if it is itself declared as pure virtual."), 730 731 // required, implementation, automated 732 M11_0_1("M11-0-1", "Member data in non-POD class types shall be private."), 733 734 // advisory, implementation, automated 735 A11_0_1("A11-0-1", "A non-POD type should be defined as class."), 736 737 // required, implementation, automated 738 A11_0_2("A11-0-2", 739 "A type defined as struct shall: (1) provide only public data members, (2) not provide any special member functions or methods, (3) not be a base of another struct or class, (4) not inherit from another struct or class."), 740 741 // required, implementation, automated 742 A11_3_1("A11-3-1", "Friend declarations shall not be used."), 743 744 // required, implementation, automated 745 A12_0_1("A12-0-1", 746 "If a class defines any special member function \"=default\", \"=delete\" or with a function definition, then all of the special member functions shall be defined."), 747 748 // required, implementation, automated 749 A12_1_1("A12-1-1", 750 "Constructors shall explicitly initialize all virtual base classes, all direct nonvirtual base classes and all non-static data members."), 751 752 // required, implementation, automated 753 M12_1_1("M12-1-1", "An object’s dynamic type shall not be used from the body of its constructor or destructor."), 754 755 // required, implementation, automated 756 A12_1_2("A12-1-2", 757 "Both NSDMI and a non-static member initializer in a constructor shall not be used in the same type."), 758 759 // required, implementation, automated 760 A12_1_3("A12-1-3", 761 "If all user-defined constructors of a class initialize data members with constant values that are the same across all constructors, then data members shall be initialized using NSDMI instead."), 762 763 // required, implementation, automated 764 A12_1_4("A12-1-4", 765 "All constructors that are callable with a single argument of fundamental type shall be declared explicit."), 766 767 // required, implementation, automated 768 A12_4_1("A12-4-1", "Destructor of a base class shall be public virtual, public override or protected non-virtual."), 769 770 // advisory, implementation, automated 771 A12_4_2("A12-4-2", "If a public destructor of a class is non-virtual, then the class should be declared final."), 772 773 // required, implementation, automated 774 A12_6_1("A12-6-1", 775 "All class data members that are initialized by the constructor shall be initialized using member initializers."), 776 777 // required, implementation, automated 778 A12_7_1("A12-7-1", 779 "If the behavior of a user-defined special member function is identical to implicitly defined special member function, then it shall be defined \"=default\" or be left undefined."), 780 781 // required, implementation, automated 782 A12_8_1("A12-8-1", 783 "Move and copy constructors shall only move and respectively copy base classes and data members of a class, without any side effects."), 784 785 // advisory, implementation, automated 786 A12_8_2("A12-8-2", 787 "User-defined copy and move assignment operators should use user-defined no-throw swap function."), 788 789 // required, implementation, partially automated 790 A12_8_3("A12-8-3", "Moved-from object shall not be read-accessed."), 791 792 // required, implementation, automated 793 A12_8_4("A12-8-4", 794 "Move constructor shall not initialize its class members and base classes using copy semantics."), 795 796 // required, implementation, automated 797 A12_8_5("A12-8-5", "A copy assignment and a move assignment operators shall handle selfassignment."), 798 799 // required, implementation, automated 800 A12_8_6("A12-8-6", 801 "Copy and move constructors and copy assignment and move assignment operators shall be declared protected or defined \"=delete\" in base class."), 802 803 // advisory, implementation, automated 804 A12_8_7("A12-8-7", "Assignment operators should be declared with the ref-qualifier &."), 805 806 // required, implementation, automated 807 A13_1_1("A13-1-1", "User-defined literals shall not be used."), 808 809 // required, implementation, automated 810 A13_1_2("A13-1-2", 811 "User defined suffixes of the user defined literal operators shall start with underscore followed by one or more letters."), 812 813 // required, implementation, automated 814 A13_1_3("A13-1-3", "User defined literals operators shall only perform conversion of passed parameters."), 815 816 // required, implementation, automated 817 A13_2_1("A13-2-1", "An assignment operator shall return a reference to \"this\"."), 818 819 // required, implementation, automated 820 A13_2_2("A13-2-2", "A binary arithmetic operator and a bitwise operator shall return a \"prvalue\"."), 821 822 // required, implementation, automated 823 A13_2_3("A13-2-3", "A relational operator shall return a boolean value."), 824 825 // required, implementation, automated 826 A13_3_1("A13-3-1", "A function that contains \"forwarding reference\" as its argument shall not be overloaded."), 827 828 // required, implementation, automated 829 A13_5_1("A13-5-1", 830 "If \"operator[]\" is to be overloaded with a non-const version, const version shall also be implemented."), 831 832 // required, implementation, automated 833 A13_6_1("A13-6-1", 834 "Digit sequences separators ’ shall only be used as follows: (1) for decimal, every 3 digits, (2) for hexadecimal, every 2 digits, (3) for binary, every 4 digits."), 835 836 // advisory, implementation, non-automated 837 A14_1_1("A14-1-1", "A template should check if a specific template argument is suitable for this template."), 838 839 // required, implementation, automated 840 M14_5_2("M14-5-2", 841 "A copy constructor shall be declared when there is a template constructor with a single parameter that is a generic parameter."), 842 843 // required, implementation, automated 844 M14_5_3("M14-5-3", 845 "A copy assignment operator shall be declared when there is a template assignment operator with a parameter that is a generic parameter."), 846 847 // required, implementation, automated 848 M14_6_1("M14-6-1", 849 "In a class template with a dependent base, any name that may be found in that dependent base shall be referred to using a qualified-id or this->."), 850 851 // required, implementation, automated 852 A14_7_1("A14-7-1", "A type used as a template argument shall provide all members that are used by the template."), 853 854 // required, implementation, automated 855 M14_7_3("M14-7-3", 856 "All partial and explicit specializations for a template shall be declared in the same file as the declaration of their primary template."), 857 858 // required, implementation, automated 859 M14_8_1("M14-8-1", "Overloaded function templates shall not be explicitly specialized."), 860 861 // advisory, implementation, automated 862 A14_8_1("A14-8-1", 863 "The set of function overloads should not contain function templates, functions specializations and non-template overloading functions."), 864 865 // required, implementation, non-automated 866 A15_0_1("A15-0-1", "A function shall not exit with an exception if it is able to complete its task."), 867 868 // required, implementation, partially automated 869 A15_0_2("A15-0-2", 870 "At least the basic guarantee for exception safety shall be provided for all operations. In addition, each function may offer either the strong guarantee or the nothrow guarantee"), 871 872 // required, implementation, non-automated 873 A15_0_3("A15-0-3", "Exception safety guarantee of a called function shall be considered."), 874 875 // required, implementation, non-automated 876 A15_0_4("A15-0-4", 877 "Unchecked exceptions shall be used to represent errors from which the caller cannot reasonably be expected to recover."), 878 879 // required, implementation, non-automated 880 A15_0_5("A15-0-5", 881 "Checked exceptions shall be used to represent errors from which the caller can reasonably be expected to recover."), 882 883 // required, verification, non-automated 884 A15_0_6("A15-0-6", 885 "An analysis shall be performed to analyze the failure modes of exception handling. In particular, the following failure modes shall be analyzed: (a) worst time execution time not existing or cannot be determined, (b) stack not correctly unwound, (c) exception not thrown, other exception thrown, wrong catch activated, (d) memory not available while exception handling."), 886 887 // required, implementation, partially automated 888 A15_0_7("A15-0-7", "Exception handling mechanism shall guarantee a deterministic worst-case time execution time."), 889 890 // required, implementation, non-automated 891 A15_0_8("A15-0-8", 892 "A worst-case execution time (WCET) analysis shall be performed to determine maximum execution time constraints of the software, covering in particular the exceptions processing."), 893 894 // required, implementation, automated 895 A15_1_1("A15-1-1", "Only instances of types derived from std::exception shall be thrown."), 896 897 // required, implementation, automated 898 A15_1_2("A15-1-2", "An exception object shall not be a pointer."), 899 900 // required, implementation, automated 901 M15_0_3("M15-0-3", 902 "Control shall not be transferred into a try or catch block using a goto or a switch statement."), 903 904 // required, implementation, automated 905 M15_1_1("M15-1-1", 906 "The assignment-expression of a throw statement shall not itself cause an exception to be thrown."), 907 908 // required, implementation, automated 909 M15_1_2("M15-1-2", "NULL shall not be thrown explicitly."), 910 911 // required, implementation, automated 912 M15_1_3("M15-1-3", "An empty throw (throw;) shall only be used in the compound statement of a catch handler."), 913 914 // advisory, implementation, automated 915 A15_1_3("A15-1-3", "All thrown exceptions should be unique."), 916 917 // required, implementation, partially automated 918 A15_1_4("A15-1-4", 919 "If a function exits with an exception, then before a throw, the function shall place all objects/resources that the function constructed in valid states or it shall delete them."), 920 921 // required, implementation, non-automated 922 A15_1_5("A15-1-5", "Exceptions shall not be thrown across execution boundaries."), 923 924 // required, implementation, automated 925 A15_2_1("A15-2-1", "Constructors that are not noexcept shall not be invoked before program startup."), 926 927 // required, implementation, partially automated 928 A15_2_2("A15-2-2", 929 "If a constructor is not noexcept and the constructor cannot finish object initialization, then it shall deallocate the object’s resources and it shall throw an exception."), 930 931 // required, implementation, automated 932 M15_3_1("M15-3-1", "Exceptions shall be raised only after start-up and before termination."), 933 934 // advisory, implementation, automated 935 A15_3_1("A15-3-1", "Unchecked exceptions should be handled only in main or thread’s main functions."), 936 937 // required, implementation, non-automated 938 A15_3_2("A15-3-2", 939 "If a function throws a checked exception, it shall be handled when meaningful actions can be taken, otherwise it shall be propagated."), 940 941 // required, implementation, automated 942 A15_3_3("A15-3-3", "There shall be at least one exception handler to catch all otherwise unhandled exceptions."), 943 944 // required, implementation, non-automated 945 A15_3_4("A15-3-4", 946 "Catch-all (ellipsis and std::exception) handlers shall be used only in (a) main, (b) task main functions, (c) in functions that are supposed to isolate independent components and (d) when calling third-party code that uses exceptions not according to AUTOSAR C++14 guidelines."), 947 948 // required, implementation, automated 949 M15_3_3("M15-3-3", 950 "Handlers of a function-try-block implementation of a class constructor or destructor shall not reference non-static members from this class or its bases."), 951 952 // required, implementation, automated 953 M15_3_4("M15-3-4", 954 "Each exception explicitly thrown in the code shall have a handler of a compatible type in all call paths that could lead to that point."), 955 956 // required, implementation, automated 957 A15_3_5("A15-3-5", "A class type exception shall be caught by reference or const reference."), 958 959 // required, implementation, automated 960 M15_3_6("M15-3-6", 961 "Where multiple handlers are provided in a single try-catch statement or function-try-block for a derived class and some or all of its bases, the handlers shall be ordered most-derived to base class."), 962 963 // required, implementation, automated 964 M15_3_7("M15-3-7", 965 "Where multiple handlers are provided in a single try-catch statement or function-try-block, any ellipsis (catch-all) handler shall occur last."), 966 967 // required, implementation, automated 968 A15_4_1("A15-4-1", "Dynamic exception-specification shall not be used."), 969 970 // required, implementation, automated 971 A15_4_2("A15-4-2", 972 "If a function is declared to be noexcept, noexcept(true) or noexcept(<true condition>), then it shall not exit with an exception."), 973 974 // required, implementation, automated 975 A15_4_3("A15-4-3", 976 "Function’s noexcept specification shall be either identical or more restrictive across all translation units and all overriders."), 977 978 // required, implementation, automated 979 A15_4_4("A15-4-4", "A declaration of non-throwing function shall contain noexcept specification."), 980 981 // required, implementation, automated 982 A15_4_5("A15-4-5", 983 "Checked exceptions that could be thrown from a function shall be specified together with the function declaration using the \"@throw ExceptionName description\" syntax, and they shall be identical in all function declarations and for all its overriders."), 984 985 // advisory, implementation, automated 986 A15_4_6("A15-4-6", "Unchecked exceptions should not be specified together with a function declaration."), 987 988 // required, implementation, automated 989 A15_5_1("A15-5-1", 990 "A class destructor, \"delete\" operators, move constructor, move assignment operator and \"swap\" function shall not exit with an exception. They shall be all specified as \"noexcept\"."), 991 992 // required, implementation, partially automated 993 A15_5_2("A15-5-2", 994 "Program shall not be abruptly terminated. In particular, an implicit or explicit invocation of std::abort(), std::quick_exit(), std::_Exit(), std::terminate() shall not be done."), 995 996 // required, implementation, automated 997 A15_5_3("A15-5-3", "The std::terminate() function shall not be called implicitly."), 998 999 // required, implementation, automated 1000 A16_0_1("A16-0-1", 1001 "The pre-processor shall only be used for unconditional and conditional file inclusion and include guards, and using the following directives: (1) #ifndef, (2) #ifdef, (3) #if, (4) #if defined, (5) #elif, (6) #else, (7) #define, (8) #endif, (9) #include."), 1002 1003 // required, implementation, automated 1004 M16_0_1("M16-0-1", 1005 "#include directives in a file shall only be preceded by other pre-processor directives or comments."), 1006 1007 // required, implementation, automated 1008 M16_0_2("M16-0-2", "Macros shall only be #define’d or #undef’d in the global namespace."), 1009 1010 // required, implementation, automated 1011 M16_0_5("M16-0-5", 1012 "Arguments to a function-like macro shall not contain tokens that look like pre-processing directives."), 1013 1014 // required, implementation, automated 1015 M16_0_6("M16-0-6", 1016 "In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ##."), 1017 1018 // required, implementation, automated 1019 M16_0_7("M16-0-7", 1020 "Undefined macro identifiers shall not be used in #if or #elif pre-processor directives, except as operands to the defined operator."), 1021 1022 // required, implementation, automated 1023 M16_0_8("M16-0-8", 1024 "If the # token appears as the first token on a line, then it shall be immediately followed by a pre-processing token."), 1025 1026 // required, implementation, automated 1027 M16_1_1("M16-1-1", "The defined pre-processor operator shall only be used in one of the two standard forms."), 1028 1029 // required, implementation, automated 1030 M16_1_2("M16-1-2", 1031 "All #else, #elif and #endif pre-processor directives shall reside in the same file as the #if or #ifdef directive to which they are related."), 1032 1033 // required, implementation, automated 1034 M16_2_3("M16-2-3", "Include guards shall be provided."), 1035 1036 // required, implementation, automated 1037 A16_2_1("A16-2-1", 1038 "The ’, \", /*, //, \\ characters shall not occur in a header file name or in #include directive."), 1039 1040 // required, implementation, automated 1041 A16_2_2("A16-2-2", "There shall be no unused include directives."), 1042 1043 // required, implementation, non-automated 1044 A16_2_3("A16-2-3", "All used include directives shall be explicitly stated."), 1045 1046 // required, implementation, automated 1047 M16_3_1("M16-3-1", "There shall be at most one occurrence of the # or ## operators in a single macro definition."), 1048 1049 // advisory, implementation, automated 1050 M16_3_2("M16-3-2", "The # and ## operators should not be used."), 1051 1052 // required, implementation, automated 1053 A16_6_1("A16-6-1", "#error directive shall not be used."), 1054 1055 // required, implementation, automated 1056 A16_7_1("A16-7-1", "The #pragma directive shall not be used."), 1057 1058 // required, implementation, automated 1059 A17_0_1("A17-0-1", 1060 "Reserved identifiers, macros and functions in the C++ standard library shall not be defined, redefined or undefined."), 1061 1062 // required, implementation, automated 1063 M17_0_2("M17-0-2", "The names of standard library macros and objects shall not be reused."), 1064 1065 // required, implementation, automated 1066 M17_0_3("M17-0-3", "The names of standard library functions shall not be overridden."), 1067 1068 // required, implementation, automated 1069 A17_0_2("A17-0-2", 1070 "All project’s code including used libraries (including standard and userdefined libraries) and any third-party user code shall conform to the AUTOSAR C++14 Coding Guidelines."), 1071 1072 // required, implementation, automated 1073 M17_0_5("M17-0-5", "The setjmp macro and the longjmp function shall not be used."), 1074 1075 // required, implementation, non-automated 1076 A17_1_1("A17-1-1", "Use of the C Standard Library shall be encapsulated and isolated."), 1077 1078 // required, implementation, automated 1079 A18_0_1("A18-0-1", "The C library facilities shall only be accessed through C++ library headers."), 1080 1081 // required, implementation, automated 1082 A18_0_2("A18-0-2", "The library functions atof, atoi and atol from library <cstdlib> shall not be used."), 1083 1084 // required, implementation, automated 1085 M18_0_3("M18-0-3", 1086 "The library functions abort, exit, getenv and system from library <cstdlib> shall not be used."), 1087 1088 // required, implementation, automated 1089 M18_0_4("M18-0-4", "The time handling functions of library <ctime> shall not be used."), 1090 1091 // required, implementation, automated 1092 M18_0_5("M18-0-5", "The unbounded functions of library <cstring> shall not be used."), 1093 1094 // required, implementation, automated 1095 A18_0_3("A18-0-3", "The library <clocale> (locale.h) and the setlocale function shall not be used."), 1096 1097 // advisory, implementation, automated 1098 A18_1_1("A18-1-1", "C-style arrays should not be used."), 1099 1100 // required, implementation, automated 1101 A18_1_2("A18-1-2", "The std::vector<bool> shall not be used."), 1102 1103 // required, implementation, automated 1104 A18_1_3("A18-1-3", "The std::auto_ptr shall not be used."), 1105 1106 // required, implementation, automated 1107 A18_1_4("A18-1-4", "The std::shared_ptr shall not refer to an array type."), 1108 1109 // required, implementation, automated 1110 A18_1_5("A18-1-5", "The std::unique_ptr shall not be passed to a function by const reference."), 1111 1112 // required, implementation, automated 1113 M18_2_1("M18-2-1", "The macro offsetof shall not be used."), 1114 1115 // required, implementation, automated 1116 A18_5_1("A18-5-1", "Functions malloc, calloc, realloc and free shall not be used."), 1117 1118 // required, implementation, partially automated 1119 A18_5_2("A18-5-2", "Operators new and delete shall not be called explicitly."), 1120 1121 // required, implementation, automated 1122 A18_5_3("A18-5-3", "The form of delete operator shall match the form of new operator used to allocate the memory."), 1123 1124 // required, implementation, automated 1125 A18_5_4("A18-5-4", 1126 "If a project has sized or unsized version of operator \"delete\" globally defined, then both sized and unsized versions shall be defined."), 1127 1128 // required, implementation, partially automated 1129 A18_5_5("A18-5-5", 1130 "Memory management functions shall ensure the following: (a) deterministic behavior resulting with the existence of worst-case execution time, (b) avoiding memory fragmentation, (c) avoid running out of memory, (d) avoiding mismatched allocations or deallocations, (e) no dependence on non-deterministic calls to kernel."), 1131 1132 // required, implementation, non-automated 1133 A18_5_6("A18-5-6", 1134 "An analysis shall be performed to analyze the failure modes of dynamic memory management. In particular, the following failure modes shall be analyzed: (a) non-deterministic behavior resulting with nonexistence of worst-case execution time, (b) memory fragmentation, (c) running out of memory, (d) mismatched allocations and deallocations, (e) dependence on non-deterministic calls to kernel."), 1135 1136 // required, implementation, non-automated 1137 A18_5_7("A18-5-7", 1138 "If non-realtime implementation of dynamic memory management functions is used in the project, then memory shall only be allocated and deallocated during non-realtime program phases."), 1139 1140 // required, implementation, automated 1141 M18_7_1("M18-7-1", "The signal handling facilities of <csignal> shall not be used."), 1142 1143 // required, implementation, automated 1144 A18_9_1("A18-9-1", "The std::bind shall not be used."), 1145 1146 // required, implementation, automated 1147 A18_9_2("A18-9-2", 1148 "Forwarding values to other functions shall be done via: (1) std::move if the value is an rvalue reference, (2) std::forward if the value is forwarding reference."), 1149 1150 // required, implementation, automated 1151 A18_9_3("A18-9-3", "The std::move shall not be used on objects declared const or const&."), 1152 1153 // required, implementation, automated 1154 A18_9_4("A18-9-4", "An argument to std::forward shall not be subsequently used."), 1155 1156 // required, implementation, automated 1157 M19_3_1("M19-3-1", "The error indicator errno shall not be used."), 1158 1159 // required, implementation, automated 1160 A23_0_1("A23-0-1", "An iterator shall not be implicitly converted to const_iterator."), 1161 1162 // required, implementation, automated 1163 M27_0_1("M27-0-1", "The stream input/output library <cstdio> shall not be used."), 1164 1165 // required, implementation, non-automated 1166 A27_0_1("A27-0-1", "Inputs from independent components shall be validated."), 1167 1168 // required, implementation, automated 1169 A27_0_2("A27-0-2", "A C-style string shall guarantee sufficient space for data and the null terminator."); 1170 1171 private final String id; 1172 1173 private final String text; 1174 1175 EAutosarCpp14Rule(String id, String name) { 1176 this.id = id; 1177 this.text = name; 1178 } 1179 1180 @Override 1181 public String getRuleId() { 1182 return id; 1183 } 1184 1185 @Override 1186 public String getRuleText() { 1187 return text; 1188 } 1189 1190 @Override 1191 public void contributeRules(BiConsumer<String, String> contributor) { 1192 contributor.accept(A2_8_2.id, "Commented-out code"); 1193 } 1194 1195}