/* >>>------------------------------------------------------------ * * File: main.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 1.1 (Required): * All code shall conform to ISO/IEC 9899:1990 C programming * language, ISO 9899, amended and corrected by ISO/IEC * 9899/COR1:1995, * ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192 * * Implemented by messages: * 180 [C99] Use of ll for conversion specifier. * * 232 [C] Value of hex escape sequence is not representable in * type 'unsigned char'. * * 233 [C] Value of octal escape sequence is not representable * in type 'unsigned char'. * * 240 [E] This file contains the control-M character at the * end of a line. * * 241 [E] This file contains the control-Z character - was * this transferred from a PC? * * 244 [C] Value of character constant is not representable in * type 'int'. * * 246 [E] Binary integer constants are a language extension. * * 261 [C] Comment still open at end of included file. * * 320 [C99] Declaration within 'for' statement. * * 321 [C] Declaration within 'for' statement defines an * identifier '%s' which is not an object. * * 322 [C] Illegal storage class specifier used in 'for' * statement declaration. * * 338 [C] Octal or hex escape sequence value is too large for * 'unsigned char' or 'wchar_t' type. * * 410 [L] Nesting of parentheses exceeds 32 - program does not * conform strictly to ISO:C90. * * 422 [C] Function call contains fewer arguments than * prototype specifies. * * 423 [C] Function call contains more arguments than prototype * specifies. * * 426 [C] Called function has incomplete return type. * * 427 [C] Object identifier used as if it were a function or a * function pointer identifier. * * 429 [C] Function argument is not of arithmetic type. * * 430 [C] Function argument is not of compatible * 'struct'/'union' type. * * 431 [C] Function argument points to a more heavily qualified * type. * * 432 [C] Function argument is not of compatible pointer type. * * 435 [C] The 'struct'/'union' member '%s' does not exist. * * 436 [C] Left operand of '.' must be a 'struct' or 'union' * object. * * 437 [C] Left operand of '->' must be a pointer to a 'struct' * or 'union' object. * * 446 [C] Operand of ++/-- must have scalar (arithmetic or * pointer) type. * * 447 [C] Operand of ++/-- must be a modifiable object. * * 448 [C] Operand of ++/-- must not be a pointer to an object * of unknown size. * * 449 [C] Operand of ++/-- must not be a pointer to a * function. * * 450 [C] An expression of array type cannot be cast. * * 451 [C] Subscripting requires a pointer (or array lvalue). * * 452 [C] Cannot subscript a pointer to an object of unknown * size. * * 453 [C] An array subscript must have integral type. * * 454 [C] The address-of operator '&' cannot be applied to an * object declared with 'register'. * * 456 [C] This expression does not have an address - '&' may * only be applied to an lvalue or a function designator. * * 457 [C] The address-of operator '&' cannot be applied to a * bit-field. * * 458 [C] Indirection operator '*' requires operand of pointer * type. * * 466 [C] Unary '+' requires arithmetic operand. * * 467 [C] Operand of '!' must have scalar (arithmetic or * pointer) type. * * 468 [C] Unary '-' requires arithmetic operand. * * 469 [C] Bitwise not '~' requires integral operand. * * 476 [C] 'sizeof' cannot be applied to a bit-field. * * 477 [C] 'sizeof' cannot be applied to a function. * * 478 [C] 'sizeof' cannot be applied to an object of unknown * size. * * 481 [C] Only scalar expressions may be cast to other types. * * 482 [C] Expressions may only be cast to 'void' or scalar * types. * * 483 [C] A pointer to an object of unknown size cannot be the * operand of an addition operator. * * 484 [C] A pointer to an object of unknown size cannot be the * operand of a subtraction operator. * * 485 [C] Only integral expressions may be added to pointers. * * 486 [C] Only integral expressions and compatible pointers * may be subtracted from pointers. * * 487 [C] If two pointers are subtracted, they must be * pointers that address compatible types. * * 493 [C] Type of left operand is not compatible with this * operator. * * 494 [C] Type of right operand is not compatible with this * operator. * * 495 [C] Left operand of '%', '<<', '>>', '&', '^' or '|' * must have integral type. * * 496 [C] Right operand of '%', '<<', '>>', '&', '^' or '|' * must have integral type. * * 513 [C] Relational operator used to compare pointers to * incompatible types. * * 514 [C] Relational operator used to compare a pointer with * an incompatible operand. * * 515 [C] Equality operator used to compare a pointer with an * incompatible operand. * * 536 [C] First operand of '&&', '||' or '?' must have scalar * (arithmetic or pointer) type. * * 537 [C] Second operand of '&&' or '||' must have scalar * (arithmetic or pointer) type. * * 540 [C] 2nd and 3rd operands of conditional operator '?' * must have compatible types. * * 541 [C] Argument no. %s does not have object type. * * 542 [C] Controlling expression must have scalar (arithmetic * or pointer) type. * * 546 [C] 'enum %s' has unknown content. Use of an enum tag * with undefined content is not permitted. * * 547 [C] This declaration of tag '%s' conflicts with a * previous declaration. * * 550 [C] Left operand of '+=' or '-=' is a pointer to an * object of unknown size. * * 551 [E] Cast may not operate on the left operand of the * assignment operator. * * 554 [C] 'static %s()' has been declared and called but no * definition has been given. * * 555 [C] Invalid assignment to object of void type or array * type. * * 556 [C] Left operand of assignment must be a modifiable * object. * * 557 [C] Right operand of assignment is not of arithmetic * type. * * 558 [C] Right operand of '+=' or '-=' must have integral * type when left operand is a pointer. * * 559 [C] Right operand of '<<=', '>>=', '&=', '|=', '^=' or * '%=' must have integral type. * * 560 [C] Left operand of '<<=', '>>=', '&=', '|=', '^=' or * '%=' must have integral type. * * 561 [C] Right operand of assignment is not of compatible * 'struct'/'union' type. * * 562 [C] Right operand of assignment points to a more heavily * qualified type. * * 563 [C] Right operand of assignment is not of compatible * pointer type. * * 564 [C] Left operand of assignment must be an lvalue (it * must designate an object). * * 565 [C] Left operand of '+=' or '-=' must be of arithmetic * or pointer to object type. * * 580 [C] Constant is too large to be representable. * * 588 [C] Width of bit-field must be an integral constant * expression. * * 589 [C] Enumeration constant must be an integral constant * expression. * * 590 [C] Array bound must be an integral constant expression. * * 591 [C] A 'case' label must be an integral constant * expression. * * 601 [E] Function 'main()' is not of type 'int (void)' or * 'int (int, char *[])'. * * 604 [C99] Declaration appears after statements in a compound * statement. * * 605 [C] A declaration must declare a tag or an identifier. * * 609 [L] More than 12 pointer, array or function declarators * modifying a declaration - program does not conform * strictly to ISO:C90. * * 611 [L] Nesting of 'struct' or 'union' types exceeds 15 - * program does not conform strictly to ISO:C90. * * 612 [L] Size of object '%s' exceeds 32767 bytes - program * does not conform strictly to ISO:C90. * * 614 [L] More than 127 block scope identifiers defined within * a block - program does not conform strictly to ISO:C90. * * 616 [C] Illegal combination of type specifiers or storage * class specifiers. * * 617 [C99] 'const' qualifier has been duplicated. * * 618 [C99] 'volatile' qualifier has been duplicated. * * 619 [C] The identifier '%s' has already been defined in the * current scope within the ordinary identifier namespace. * * 620 [C] Cannot initialize '%s' because it has unknown size. * * 621 [C] The struct/union '%s' cannot be initialized because * it has unknown size. * * 622 [C] The identifier '%s' has been declared both with and * without linkage in the same scope. * * 627 [C] '%s' has different type to previous declaration in * the same scope. * * 628 [C] '%s' has different type to previous declaration at * wider scope. * * 629 [C] More than one definition of '%s' (with internal * linkage). * * 631 [C] More than one declaration of '%s' (with no linkage). * * 633 [E] Empty structures and unions are a language * extension. * * 635 [E] Bit-fields in this struct/union have been declared * with types other than int, signed int or unsigned int. * * 638 [C] Duplicate member name '%s' in 'struct' or 'union'. * * 639 [L] Number of members in 'struct' or 'union' exceeds 127 * - program does not conform strictly to ISO:C90. * * 640 [C] '%s' in 'struct' or 'union' type may not have 'void' * type. * * 641 [C] '%s' in 'struct' or 'union' type may not have * function type. * * 642 [C] '%s' in 'struct' or 'union' type may not be an array * of unknown size. * * 643 [C] '%s' in 'struct' or 'union' type may not be a * 'struct' or 'union' with unknown content. * * 644 [C] Width of bit-field must be no bigger than the width * of an 'int'. * * 645 [C] A zero width bit-field cannot be given a name. * * 646 [C] Enumeration constants must have values representable * as 'int's. * * 647 [L] Number of enumeration constants exceeds 127 - * program does not conform strictly to ISO:C90. * * 649 [C] K&R style declaration of parameters is not legal * after a function header that includes a parameter list. * * 650 [C] Illegal storage class specifier on named function * parameter. * * 651 [C] Missing type specifiers in function declaration. * * 653 [C] Duplicate definition of 'struct', 'union' or 'enum' * tag '%s'. * * 655 [C] Illegal storage class specifier on unnamed function * parameter. * * 656 [C] Function return type cannot be function or array * type, or an incomplete struct/union (for function * definition). * * 657 [C] Unnamed parameter specified in function definition. * * 659 [C] The identifier '%s' was not given in the parameter * list. * * 660 [E] Defining an unnamed member in a struct or union. * This is a language extension. * * 662 [E] Accessing a member of an unnamed struct or union * member in this way is a language extension. * * 664 [C] Parameter specified with type 'void'. * * 665 [C] Two parameters have been declared with the same name * '%s'. * * 671 [C] Initializer for object of arithmetic type is not of * arithmetic type. * * 673 [C] Initializer points to a more heavily qualified type. * * 674 [C] Initializer for pointer is of incompatible type. * * 675 [C] Initializer is not of compatible 'struct'/'union' * type. * * 677 [C] Array size is negative, or unrepresentable. * * 682 [C] Initializer for object of a character type is a * string literal. * * 683 [C] Initializer for object of a character type is a wide * string literal. * * 684 [C] Too many initializers. * * 685 [C] Initializer for any object with static storage * duration must be a constant expression. * * 690 [C] String literal contains too many characters to * initialize object. * * 698 [C] String literal used to initialize an object of * incompatible type. * * 699 [C] String literal used to initialize a pointer of * incompatible type. * * 708 [C] No definition found for the label '%s' in this * function. * * 709 [C] Initialization of locally declared 'extern %s' is * illegal. * * 715 [L] Nesting of control structures (statements) exceeds * 15 - program does not conform strictly to ISO:C90. * * 736 [C] 'case' label does not have unique value within this * 'switch' statement. * * 737 [C] More than one 'default' label found in 'switch' * statement. * * 738 [C] Controlling expression in a 'switch' statement must * have integral type. * * 739 [L] Number of 'case' labels exceeds 257 - program does * not conform strictly to ISO:C90. * * 746 [C] 'return exp;' found in '%s()' whose return type is * 'void'. * * 747 [C] 'return exp;' found in '%s()' whose return type is * qualified 'void'. * * 755 [C] 'return' expression is not of arithmetic type. * * 756 [C] 'return' expression is not of compatible * 'struct'/'union' type. * * 757 [C] 'return' expression points to a more heavily * qualified type. * * 758 [C] 'return' expression is not of compatible pointer * type. * * 766 [C] 'continue' statement found outside an iteration * statement. * * 767 [C] 'break' statement found outside a 'switch' or * iteration statement. * * 768 [C] 'case' or 'default' found outside a 'switch' * statement. * * 774 [C] 'auto' may not be specified on global declaration of * '%s'. * * 775 [C] 'register' may not be specified on global * declaration of '%s'. * * 801 [C] The '##' operator may not be the first token in a * macro replacement list. * * 802 [C] The '##' operator may not be the last token in a * macro replacement list. * * 803 [C] The '#' operator may only appear before a macro * parameter. * * 804 [C] Macro parameter '%s' is not unique. * * 810 [L] '#include "%s"' causes nesting to exceed 8 levels - * program does not conform strictly to ISO:C90. * * 811 [C] The glue operator '##' may only appear in a * '#define' preprocessing directive. * * 812 [C] Header name token '' found outside '#include' * preprocessing directive. * * 821 [C] '#include %s' does not identify a header or source * file that can be processed. * * 828 [L] More than 8 levels of nested conditional inclusion - * program does not conform strictly to ISO:C90. * * 830 [E] Unrecognized text encountered after a preprocessing * directive. * * 831 [E] Use of '\\' in this '#include' line is a PC * extension - this usage is non-portable. * * 834 [C] Function-like macro '%s()' is being redefined as an * object-like macro. * * 835 [C] Macro '%s' is being redefined with different * parameter names. * * 844 [C] Macro '%s' is being redefined with a different * replacement list. * * 845 [C] Object-like macro '%s' is being redefined as a * function-like macro. * * 850 [C99] Macro argument is empty. * * 851 [C] More arguments in macro call than specified in * definition. * * 852 [C] Unable to find the ')' that marks the end of the * macro call. * * 856 [C] Fewer arguments in macro call than specified in * definition. * * 857 [L] Number of macro definitions exceeds 1024 - program * does not conform strictly to ISO:C90. * * 858 [L] Number of macro parameters exceeds 31 - program does * not conform strictly to ISO:C90. * * 859 [L] Number of arguments in macro call exceeds 31 - * program does not conform strictly to ISO:C90. * * 866 [C] The string literal in a '#line' directive cannot be * a 'wide string literal'. * * 873 [C] Preprocessing token cannot be converted to an actual * token. * * 875 [L] String literal exceeds 509 characters - program does * not conform strictly to ISO:C90. * * 877 [C] '#if' and '#elif' expressions may contain only * integral constants. * * 899 [E] Unrecognized preprocessing directive has been * ignored - assumed to be a language extension. * * 930 [C99] Trailing comma at the end of an enumerator-list. * * 940 [C] Illegal usage of a variably modified type. * * 941 [C] A variable length array may not be initialized. * * 943 [C] Jump to label '%s' is a jump into the scope of an * identifier with variably modified type. * * 944 [C] The label '%s' is inside the scope of an identifier * with variably modified type. * * 945 [C99] WARNING. Operand of sizeof is an expression of * variable length array type. * * 1001 [E] '#include %s' is a VMS extension. * * 1002 [E] '%s' is not a legal identifier in ISO C. * * 1003 [E] '#%s' is a language extension for in-line assembler. * All statements located between #asm and #endasm will be * ignored. * * 1006 [E] This in-line assembler construct is a language * extension. The code has been ignored. * * 1008 [E] '#%s' is not a legal ISO C preprocessing directive. * * 1011 [C99] Use of '//' comment. * * 1012 [E] Use of a C++ reference type ('type &') will be * treated as a language extension. * * 1014 [E] Non-standard type specifier - this will be treated * as a language extension. * * 1015 [E] '%s' is not a legal keyword in ISO C - this will be * treated as a language extension. * * 1018 [C99] Use of LL suffix. * * 1019 [E] '@ address' is not supported in ISO C - this will be * treated as a language extension. * * 1020 [E] '__typeof__' is not supported in ISO C, and is * treated as a language extension. * * 1021 [E] A statement expression is not supported in ISO C, * and is treated as a language extension. * * 1022 [E] '__alignof__' is not supported in ISO C, and is * treated as a language extension. * * 1023 [C] Using '__alignof__' on function types is illegal. * * 1024 [C] Using '__alignof__' on incomplete types is illegal. * * 1025 [C] Using '__alignof__' on bit-fields is illegal. * * 1026 [E] The indicated @word construct has been ignored. * * 1027 [C99] Use of type 'long long'. * * 1028 [E] Use of the sizeof operator in a preprocessing * directive is a language extension. * * 1029 [E] Whitespace encountered between backslash and * new-line has been ignored. * * 1030 [C99] Macro defined with variable argument list. * * 1031 [C99] Initializer for 'struct', 'union' or array type is * not a constant expression. * * 1033 [C] The identifier __VA_ARGS__ may only be used in the * replacement list of a variadic macro. * * 1034 [E] Macro defined with named variable argument list. * This is a language extension. * * 1035 [E] No macro arguments supplied for variable argument * list. This is a language extension. * * 1036 [E] Comma before ## ignored in expansion of variadic * macro. This is a language extension. * * 1037 [E] Arrays of length zero are a language extension. * * 1038 [E] The sequence ", ##__VA_ARGS__" is a language * extension. * * 1041 [E] Empty aggregate initializers are a language * extension. * * 1042 [E] Using I64 or UI64 as an integer constant suffix. * This is a language extension. * * 1043 [E] Defining an anonymous union object. This is a * language extension. * * 1044 [E] Defining an anonymous struct object. This is a * language extension. * * 1045 [E] Use of the #include_next preprocessing directive is * a language extension. * * 1046 [E] Function is being declared with default argument * syntax. This is a language extension. * * 1047 [C] Function is being declared with default argument * syntax after a previous call to the function. This is * not allowed. * * 1048 [C] Default argument values are missing for some * parameters in this function declaration. This is not * allowed. * * 1051 [C99] A variable length array has been declared. * * 1052 [C99] A variable length array of unspecified size has * been declared. * * 1053 [C99] Designators have been used in this initialization * list. * * 1054 [C99] A compound literal has been used. * * 1055 [C99] The keyword 'inline' has been used. * * 1056 [C99] The keyword '_Bool' has been used. * * 3236 [C] 'inline' may not be applied to function 'main'. * * 3237 [C] inline function '%1s' has external linkage and is * defining an object, '%2s', with static storage duration. * * 3238 [C] inline function '%1s' has external linkage and is * referring to an object, '%2s', with internal linkage. * * 3244 [C] 'inline' may only be used in the declaration of a * function identifier. * * 3664 [E] Using a dot operator to access an individual bit is * a language extension. * * <<<------------------------------------------------------------ */ /* PRQA S 862,2986,3205,3207,3210,3408,3447,4105,4130 ++ */ #include "misra.h" #include "m2cmex.h" #include "gen.h" #include "rule_19.1.h" S16 obj_0505a = 0; /* MISRA Violation - Rule 5.5 & Rule 8.8 */ S16 obj_0505b = 0; /* MISRA Violation - Rule 5.5 & Rule 8.8 */ static S16 obj_0505c = 0; /* MISRA Violation - Rule 5.5 */ static S16 obj_0505d = 0; /* MISRA Violation - Rule 5.5 */ extern S16 obj_0808d; /* MISRA Violation - Rule 8.8 */ S16 obj_0809b = 0; /* MISRA Violation - Rule 8.9 */ extern S32 obj_0804d = 0; /* MISRA Violation - Rule 8.4 & Rule 8.8 */ extern S16 test_0809(void) /* MISRA Violation - Rule 8.9 */ { return 2; } int main( void ) { static S16 obj_0505e = 1; /* MISRA Violation - Rule 5.5 */ S16 err = 0; put_line( "Date: " __DATE__ ", Time: " __TIME__ ); err |= test_0101(); err |= test_0102(); err |= test_0103(); err |= test_0104(); err |= test_0105(); err |= test_0201(); err |= test_0202(); err |= test_0203(); err |= test_0204(); err |= test_0301(); err |= test_0302(); err |= test_0303(); err |= test_0304(); err |= test_0305(); err |= test_0306(); err |= test_0401(); err |= test_0402(); err |= test_0501(); err |= test_0502(); err |= test_0503(); err |= test_0504(); err |= test_0505(); err |= test_0506(); err |= test_0507(); err |= test_0601(); err |= test_0602(); err |= test_0603(); err |= test_0604(); err |= test_0605(); err |= test_0701(); err |= test_0801(); err |= test_0802(); err |= test_0803(); err |= obj_0804a[ 0 ]; err |= test_0804a(); err |= test_0804b(); err |= test_0805(); err |= test_0806(); err |= test_0807a(); err |= test_0807b(); err |= test_0808(); err |= test_0809(); err |= test_0810(); err |= test_0812(); err |= test_0901(); err |= test_0902(); err |= test_0903(); err |= test_1001(); err |= test_1002(); err |= test_1003(); err |= test_1004(); err |= test_1005(); err |= test_1006(); err |= test_1101(); err |= test_1102(); err |= test_1103(); err |= test_1104(); err |= test_1105(); err |= test_1201(); err |= test_1202(); err |= test_1203(); err |= test_1204(); err |= test_1205(); err |= test_1206(); err |= test_1207(); err |= test_1208(); err |= test_1209(); err |= test_1210(); err |= test_1211(); err |= test_1212(); err |= test_1213(); err |= test_1301(); err |= test_1302(); err |= test_1303(); err |= test_1304(); err |= test_1305(); err |= test_1306(); err |= test_1307(); err |= test_1401(); err |= test_1402(); err |= test_1403(); err |= test_1404(); err |= test_1405(); err |= test_1406(); err |= test_1407(); err |= test_1408(); err |= test_1409(); err |= test_1410(); err |= test_1500(); err |= test_1501(); err |= test_1502(); err |= test_1503(); err |= test_1504(); err |= test_1505(); err |= test_1601(); err |= test_1602(); err |= test_1603(); err |= test_1604(); err |= test_1605(); err |= test_1606(); err |= test_1607(); err |= test_1608(); err |= test_1609(); err |= test_1610(); err |= test_1701(); err |= test_1702(); err |= test_1703(); err |= test_1704(); err |= test_1705(); err |= test_1706(); err |= test_1801(); err |= test_1802(); err |= test_1803(); err |= test_1804(); err |= test_1901(); err |= test_1902(); err |= test_1903(); err |= test_1904(); err |= test_1905(); err |= test_1906(); err |= test_1907(); err |= test_1908(); err |= test_1909(); err |= test_1910(); err |= test_1911(); err |= test_1912(); err |= test_1913(); err |= test_1914(); err |= test_1915(); err |= test_1916(); err |= test_1917(); err |= test_2001(); err |= test_2002(); err |= test_2003(); err |= test_2004(); err |= test_2005(); err |= test_2006(); err |= test_2007(); err |= test_2008(); err |= test_2009(); err |= test_2010(); err |= test_2011(); err |= test_2012(); err |= test_2101(); return err; }