
//// MISRA C 1998

/// MISRA 1998
// All code shall conform to ISO 9899 standard C, with no extensions permitted.
1546 "MISRA Rule 1"   m98_all m98_req m98_1
667  "MISRA Rule 1"   m98_all m98_req m98_1
// Code written in languages other than C...
0    "MISRA Rule 2"   m98_all m98_adv m98_2
// Assembly language functions should contain only assembly language.
1749 "MISRA Rule 3"   m98_all m98_adv m98_3
1839 "MISRA Rule 3"   m98_all m98_adv m98_3
// Provision should be made for appropriate run-time checking.
0    "MISRA Rule 4"   m98_all m98_adv m98_4
// Only those characters defined in the ISO C standard shall be used.
192  "MISRA Rule 5"   m98_all m98_req m98_5
1823 "MISRA Rule 5"   m98_all m98_req m98_5
// Values of character types shall be restricted to ISO 10646-1.
0    "MISRA Rule 6"   m98_all m98_req m98_6
// Trigraphs shall not be used.
1695 "MISRA Rule 7"   m98_all m98_req m98_7
// Multibyte characters and wide string literals shall not be used.
1720 "MISRA Rule 8"   m98_all m98_req m98_8
1823 "MISRA Rule 8"   m98_all m98_req m98_8
// Comments shall not be nested.
9    "MISRA Rule 9"   m98_all m98_req m98_9
// Sections of code should not be commented out.
1771 "MISRA Rule 10"  m98_all m98_adv m98_10
// Identifiers shall not rely on significance of more than 31 characters.
0    "MISRA Rule 11"  m98_all m98_req m98_11
// No identifier in one namespace shall match an identifier in another.
1723 "MISRA Rule 12"  m98_all m98_adv m98_12
// The basic types should not be used.
1698 "MISRA Rule 13"  m98_all m98_adv m98_13
// The type char shall always be declared as unsigned char or signed char.
1699 "MISRA Rule 14"  m98_all m98_req m98_14
// Floating point implementations should comply with a defined standard.
0    "MISRA Rule 15"  m98_all m98_adv m98_15
// The underlying bit representations of floats shall not be used in any way.
1820 "MISRA Rule 16"  m98_all m98_req m98_16
// typedef names shall not be reused.
1722 "MISRA Rule 17"  m98_all m98_req m98_17
1841 "MISRA Rule 17"  m98_all m98_req m98_17
// Numeric constants should be suffixed to indicate type.
1775 "MISRA Rule 18"  m98_all m98_adv m98_18
// Octal constants (other than zero) shall not be used.
1718 "MISRA Rule 19"  m98_all m98_req m98_19
// All object and function identifiers shall be declared before use.
223  "MISRA Rule 20"  m98_all m98_req m98_20
// Identifiers in an inner scope shall not hide identifiers in outer scopes.
460  "MISRA Rule 21"  m98_all m98_req m98_21
1721 "MISRA Rule 21"  m98_all m98_req m98_21
// Declarations of objects should be at function scope.
0    "MISRA Rule 22"  m98_all m98_adv m98_22
// All declarations at file scope should be static where possible.
0    "MISRA Rule 23"  m98_all m98_adv m98_23
// Identifiers shall not simultaneously have internal and external linkage.
172  "MISRA Rule 24"  m98_all m98_req m98_24
// An identifier with external linkage shall have exactly one definition.
1797 "MISRA Rule 25"  m98_all m98_req m98_25
// If objects or functions are declared more than once...
147  "MISRA Rule 26"  m98_all m98_req m98_26
// External objects should not be declared in more than one file.
0    "MISRA Rule 27"  m98_all m98_adv m98_27
// The register storage class should not be used.
1696 "MISRA Rule 28"  m98_all m98_adv m98_28
// The use of a tag shall agree with its declaration.
188  "MISRA Rule 29"  m98_all m98_req m98_29
469  "MISRA Rule 29"  m98_all m98_req m98_29
1842 "MISRA Rule 29"  m98_all m98_req m98_29
// All automatic variables shall have been assigned a value before use.
549  "MISRA Rule 30"  m98_all m98_req m98_30
// Braces shall be used to indicate structure in array and struct initializers.
146  "MISRA Rule 31"  m98_all m98_req m98_31
991  "MISRA Rule 31"  m98_all m98_req m98_31
1162 "MISRA Rule 31"  m98_all m98_req m98_31
// In an enumerator list, the '=' construct shall not be used other than ...
1726 "MISRA Rule 32"  m98_all m98_req m98_32
// The right hand operand of && or || shall not contain side effects.
1724 "MISRA Rule 33"  m98_all m98_req m98_33
// The operands of && or || shall be primary expressions.
1729 "MISRA Rule 34"  m98_all m98_req m98_34
// Assignment operators shall not be used in expressions which return bool.
1738 "MISRA Rule 35"  m98_all m98_req m98_35
// Logical operators should not be confused with bitwise operators.
1853 "MISRA Rule 36"  m98_all m98_adv m98_36
1854 "MISRA Rule 36"  m98_all m98_adv m98_36
// Bitwise operations shall not be performed on signed integer types.
1730 "MISRA Rule 37"  m98_all m98_req m98_37
// The right hand operand of a shift shall lie between zero and width-1.
62   "MISRA Rule 38"  m98_all m98_req m98_38
63   "MISRA Rule 38"  m98_all m98_req m98_38
// The unary minus operator shall not be applied to an unsigned expression.
1702 "MISRA Rule 39"  m98_all m98_req m98_39
// The sizeof operator should not be used on expressions with side effects.
1725 "MISRA Rule 40"  m98_all m98_adv m98_40
// The implementation of integer division should be determined.
0    "MISRA Rule 41"  m98_all m98_adv m98_41
// The comma operator shall not be used, except in for loop headers.
1719 "MISRA Rule 42"  m98_all m98_req m98_42
// Implicit conversions which may result in a loss of information ...
1739 "MISRA Rule 43"  m98_all m98_req m98_43
1863 "MISRA Rule 43"  m98_all m98_req m98_43
1864 "MISRA Rule 43"  m98_all m98_req m98_43
1865 "MISRA Rule 43"  m98_all m98_req m98_43
1866 "MISRA Rule 43"  m98_all m98_req m98_43
1867 "MISRA Rule 43"  m98_all m98_req m98_43
1868 "MISRA Rule 43"  m98_all m98_req m98_43
1869 "MISRA Rule 43"  m98_all m98_req m98_43
1870 "MISRA Rule 43"  m98_all m98_req m98_43
// Redundant explicit casts should not be used.
1740 "MISRA Rule 44"  m98_all m98_adv m98_44
// Type casting from any type to or from pointers shall not be used.
1703 "MISRA Rule 45"  m98_all m98_req m98_45
// The value of an expression shall be the same across orders of evaluation.
0    "MISRA Rule 46"  m98_all m98_req m98_46
// No dependence should be placed on C's operator precedence rules.
1737 "MISRA Rule 47"  m98_all m98_adv m98_47
// Mixed precision arithmetic should use explicit casting.
1751 "MISRA Rule 48"  m98_all m98_adv m98_48
// Tests of a value against zero should be made explicit.
1855 "MISRA Rule 49"  m98_all m98_adv m98_49
1881 "MISRA Rule 49"  m98_all m98_adv m98_49
// Floating point variables shall not be tested for exact equality.
1704 "MISRA Rule 50"  m98_all m98_req m98_50
// Evaluation of constant unsigned integer expressions should not wrap around.
1735 "MISRA Rule 51"  m98_all m98_adv m98_51
// There shall be no unreachable code.
111  "MISRA Rule 52"  m98_all m98_req m98_52
// All non-null statements shall have a side-effect.
174  "MISRA Rule 53"  m98_all m98_req m98_53
// A null statement shall only occur on a line by itself.
1746 "MISRA Rule 54"  m98_all m98_req m98_54
// Labels should not be used, except in switch statements.
1708 "MISRA Rule 55"  m98_all m98_adv m98_55
// The goto statement shall not be used.
1705 "MISRA Rule 56"  m98_all m98_req m98_56
// The continue statement shall not be used.
1706 "MISRA Rule 57"  m98_all m98_req m98_57
// The break statement shall not be used (except in a switch statement).
1707 "MISRA Rule 58"  m98_all m98_req m98_58
// The body of an if, while, do, or for shall always be enclosed in braces.
1709 "MISRA Rule 59"  m98_all m98_req m98_59
1826 "MISRA Rule 59"  m98_all m98_req m98_59
// All if, else if constructs should contain a final else clause.
1710 "MISRA Rule 60"  m98_all m98_adv m98_60
// Every non-empty case clause in a switch statement shall have a break.
1711 "MISRA Rule 61"  m98_all m98_req m98_61 m98_switch
1884 "MISRA Rule 61"  m98_all m98_req m98_61 m98_switch
// All switch statements should contain a final default clause.
1712 "MISRA Rule 62"  m98_all m98_req m98_62 m98_switch
1837 "MISRA Rule 62"  m98_all m98_req m98_62 m98_switch
// A switch expression should not represent a Boolean value.
1733 "MISRA Rule 63"  m98_all m98_adv m98_63 m98_switch
1944 "MISRA Rule 63"  m98_all m98_adv m98_63 m98_switch
// Every switch statement shall have at least one case.
1713 "MISRA Rule 64"  m98_all m98_req m98_64 m98_switch
// Floating point variables shall not be used as loop counters.
1750 "MISRA Rule 65"  m98_all m98_req m98_65
// Only expressions concerned with loop control should appear in the header.
0    "MISRA Rule 66"  m98_all m98_adv m98_66
// Variables being used for iteration should not be modified in the body.
0    "MISRA Rule 67"  m98_all m98_adv m98_67
// Functions shall always be declared at file scope.
1731 "MISRA Rule 68"  m98_all m98_req m98_68
// Functions with variable numbers of arguments shall not be used.
1697 "MISRA Rule 69"  m98_all m98_req m98_69
// Functions shall not call themselves, either directly or indirectly.
0    "MISRA Rule 70"  m98_all m98_req m98_70
// Functions shall always have visible prototype declarations.
//223  "MISRA Rule 71"  m98_all m98_req m98_71
1547 "MISRA Rule 71"  m98_all m98_req m98_71
1791 "MISRA Rule 71"  m98_all m98_req m98_71
1800 "MISRA Rule 71"  m98_all m98_req m98_71
1828 "MISRA Rule 71"  m98_all m98_req m98_71
// The type given in the declaration and definition shall be identical.
1844 "MISRA Rule 72"  m98_all m98_req m98_72
// Identifiers shall either be given for all the parameters, or for none.
1727 "MISRA Rule 73"  m98_all m98_req m98_73
// If identifiers are given, then those in the definition shall be identical.
1745 "MISRA Rule 74"  m98_all m98_req m98_74
// Every function shall have an explicit return type.
77   "MISRA Rule 75"  m98_all m98_req m98_75
260  "MISRA Rule 75"  m98_all m98_req m98_75
837  "MISRA Rule 75"  m98_all m98_req m98_75
938  "MISRA Rule 75"  m98_all m98_req m98_75
// Functions with no parameters shall be declared with parameter type void.
1728 "MISRA Rule 76"  m98_all m98_req m98_76
// The type of parameters passed shall be compatible with the expected types.
0    "MISRA Rule 77"  m98_all m98_req m98_77
// The number of parameters passed shall match the function prototype.
140  "MISRA Rule 78"  m98_all m98_req m98_78
165  "MISRA Rule 78"  m98_all m98_req m98_78
// The values returned by void functions shall not be used.
0    "MISRA Rule 79"  m98_all m98_req m98_79
// Void expressions shall not be passed as function parameters.
0    "MISRA Rule 80"  m98_all m98_req m98_80
// const qualification should be used on reference parameters.
0    "MISRA Rule 81"  m98_all m98_adv m98_81
// A function should have a single point of exit.
1734 "MISRA Rule 82"  m98_all m98_adv m98_82
// Each return shall have an expression; it shall match the return type.
117  "MISRA Rule 83"  m98_all m98_req m98_83
//120  "MISRA Rule 83"  m98_all m98_req m98_83
940  "MISRA Rule 83"  m98_all m98_req m98_83
// For functions with void type, return statements shall not have expressions.
//118  "MISRA Rule 84"  m98_all m98_req m98_84
// Functions called with no parameters should have empty parentheses.
1774 "MISRA Rule 85"  m98_all m98_adv m98_85
// If a function returns error information, then it should be tested.
0    "MISRA Rule 86"  m98_all m98_adv m98_86
// #include statements shall only be preceded by other directives or comments.
1748 "MISRA Rule 87"  m98_all m98_req m98_87
// Non-standard characters shall not occur in header file names.
1747 "MISRA Rule 88"  m98_all m98_req m98_88
// The #include directive shall be followed by <filename> or "filename".
//13   "MISRA Rule 89"  m98_all m98_req m98_89
// C macros shall only be used for ...
1776 "MISRA Rule 90"  m98_all m98_req m98_90
1859 "MISRA Rule 90"  m98_all m98_req m98_90
1860 "MISRA Rule 90"  m98_all m98_req m98_90
1886 "MISRA Rule 90"  m98_all m98_req m98_90
// Macros shall not be #define'd and #undef'd within a block.
1732 "MISRA Rule 91"  m98_all m98_req m98_91
// #undef should not be used.
1715 "MISRA Rule 92"  m98_all m98_adv m98_92
// A function should be used in preference to a function-like macro.
1862 "MISRA Rule 93"  m98_all m98_adv m98_93
// A function-like macro shall not be 'called' without its arguments.
54   "MISRA Rule 94"  m98_all m98_req m98_94
76   "MISRA Rule 94"  m98_all m98_req m98_94
// Arguments to a macro shall not contain preprocessing directives.
10   "MISRA Rule 95"  m98_all m98_req m98_95
// The whole definition, and each parameter, shall be enclosed in parentheses.
1743 "MISRA Rule 96"  m98_all m98_req m98_96
1829 "MISRA Rule 96"  m98_all m98_req m98_96
// Identifiers in preprocessor directives should be defined before use.
193  "MISRA Rule 97"  m98_all m98_adv m98_97
// There shall be at most one # or ## operator in a single macro definition.
1716 "MISRA Rule 98"  m98_all m98_req m98_98
// All uses of the #pragma directive shall be documented and explained.
0    "MISRA Rule 99"  m98_all m98_req m98_99
// The defined preprocessor operator shall only be used in standard forms.
1831 "MISRA Rule 100" m98_all m98_req m98_100
1902 "MISRA Rule 100" m98_all m98_req m98_100
// Pointer arithmetic should not be used.
1752 "MISRA Rule 101" m98_all m98_adv m98_101
//1858 "MISRA Rule 101" m98_all m98_adv m98_101
// No more than 2 levels of pointer indirection should be used.
1741 "MISRA Rule 102" m98_all m98_adv m98_102
// Relational operators shall not be applied to pointer types except ...
1961 "MISRA Rule 103" m98_all m98_req m98_103
// Non-constant pointers to functions shall not be used.
1777 "MISRA Rule 104" m98_all m98_req m98_104
// All the functions pointed to by a function pointer shall have the same type.
1778 "MISRA Rule 105" m98_all m98_req m98_105
// The address of an object shall not be assigned to an outer-scoped object.
1056 "MISRA Rule 106" m98_all m98_req m98_106
1780 "MISRA Rule 106" m98_all m98_req m98_106
// The null pointer shall not be dereferenced.
0    "MISRA Rule 107" m98_all m98_req m98_107
// In the specification of a struct type, all members shall be specified.
0    "MISRA Rule 108" m98_all m98_req m98_108
// Overlapping variable storage shall not be used.
0    "MISRA Rule 109" m98_all m98_req m98_109
// Unions shall not be used to access the sub-parts of larger data types.
1819 "MISRA Rule 110" m98_all m98_req m98_110
1827 "MISRA Rule 110" m98_all m98_req m98_110
// Bit fields shall only be defined of type unsigned int or signed int.
230  "MISRA Rule 111" m98_all m98_req m98_111
1717 "MISRA Rule 111" m98_all m98_req m98_111
// Bit fields of type signed int shall be at least 2 bits long.
108  "MISRA Rule 112" m98_all m98_req m98_112
// All the members of a structure (or union) shall be named.
1742 "MISRA Rule 113" m98_all m98_req m98_113
// Reserved words and function names shall not be redefined or undefined.
45   "MISRA Rule 114" m98_all m98_req m98_114
46   "MISRA Rule 114" m98_all m98_req m98_114
1861 "MISRA Rule 114" m98_all m98_req m98_114
1888 "MISRA Rule 114" m98_all m98_req m98_114
// Standard library function names shall not be reused.
0    "MISRA Rule 115" m98_all m98_req m98_115
// All libraries shall comply with MISRA C 1998, and be subject to validation.
0    "MISRA Rule 116" m98_all m98_req m98_116
// The validity of values passed to library functions shall be checked.
0    "MISRA Rule 117" m98_all m98_req m98_117
// Dynamic heap memory allocation shall not be used.
0    "MISRA Rule 118" m98_all m98_req m98_118
// The error indicator errno shall not be used.
0    "MISRA Rule 119" m98_all m98_req m98_119
// The macro offsetof, in library <stddef.h>, shall not be used.
0    "MISRA Rule 120" m98_all m98_req m98_120
// <locale.h> and the setlocale function shall not be used.
0    "MISRA Rule 121" m98_all m98_req m98_121
// The setjmp macro and the longjmp function shall not be used.
1906 "MISRA Rule 122" m98_all m98_req m98_122
// The signal-handling facilities of <signal.h> shall not be used.
0    "MISRA Rule 123" m98_all m98_req m98_123
// The input/output library <stdio.h> shall not be used in production code.
0    "MISRA Rule 124" m98_all m98_req m98_124
// The library functions atof, atoi and atol from <stdlib.h> shall not be used.
1907 "MISRA Rule 125" m98_all m98_req m98_125
// The library functions abort, exit, getenv and system shall not be used.
0    "MISRA Rule 126" m98_all m98_req m98_126
// The time handling functions of library <time.h> shall not be used.
0    "MISRA Rule 127" m98_all m98_req m98_127
diag_warning m98_adv
diag_error m98_req
