ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.

Abraxas/Misra Home  Table of Contents  MISRA is a registered trademark of www.misra.uk.org

CodeCheck Rule-Files for MISRA-C:1998/MISRA-C:2004 - misra-c.ccp


/* Misra C Enforcement Testing */

/* Rule 1: Required */

/* ISO 9899 conformance. */

/* This requires a toolset to be run against the FIPS 160 compiler */

/* validation suite or equivalent. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 2: Advisory */

/* Interfaces to other languages. */

/* Not automatically enforceable. Requires manual inspection techniques. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 3: Advisory */

/* Interfaces to other assembly languages. */

/* Inline assembly language violates Rule 1. */

/* Calling a function is not automatically enforceable and */

/* requires manual inspection techniques. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 4: Advisory */

/* Provision should be made for run-time checking. */

/* Not automatically enforceable. Requires manual inspection techniques. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 5: Required */

/* Non ISO C characters. */

MISRA-C [1998:2004] Function Definition: rule5

/* The official 91-character set. */

/* Checker should produce no messages. */

/* An extended character. */

/* Checker should warn. ( Note cannot test for all eventualities, */

/* there are simply too many, although the coding in the checker is */

/* easy. If done correctly, one counter-example should be enough ) . */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 6: Required */

/* ISO 10646-1 conformance. */

/* Not automatically enforceable. Requires manual inspection techniques. */

/* C++ */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 7: Required */

/* No trigraphs */

MISRA-C [1998:2004] Function Definition: rule7

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 8: Required */

/* No multibyte characters or wide string literals */

MISRA-C [1998:2004] Function Definition: rule8

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 9: Required */

/* No nested comments */

/* RULE 9 */

/* more */ /* rule 9 comment in comment, supported by codecheck -N option */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 10: Advisory */

/* Code shall not be commented out. */

/* Not automatically enforceable. Requires manual inspection techniques. */

* Rule 10: Advisory

* Code shall not be commented out.

* Not automatically enforceable. Requires manual inspection techniques.

/* int foo; */

main() {

int important;

return;

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 11: Required */

/* No reliance on more than 31 character significance. */

MISRA-C [1998:2004] Function Definition: rule11

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 12: Advisory */

/* Identifiers in different name spaces shall have different spelling. */

/* x is first used in function prototype namespace. */

/* x is now used in structure tag and structure member namespace. */

MISRA-C [1998:2004] Function Definition: func12

/* x is now used in the remaining name space. */

/* x is used in the label name space */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 13: Advisory */

/* The basic types char, short, int, long, float and double should not */

/* be used. */

MISRA-C [1998:2004] Function Definition: rule13

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 14: Required */

/* char should only be used with the signed or unsigned keyword. */

MISRA-C [1998:2004] Function Definition: rule14

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 15: Advisory */

/* Floating point implementations should comply with a defined */

/* floating point standard. */

/* Not automatically enforceable. Requires use of packages such as */

/* paranoia. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 16: Required */

/* Underlying floating point bit representations should not be used. */

/* Not automatically enforceable. */

MISRA-C [1998:2004] Function Definition: m16

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 17: Required */

/* typedef names shall not be reused. */

MISRA-C [1998:2004] Function Definition: m17

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 18: Advisory */

/* Numeric constants should be suffixed to indicate type if an */

/* appropriate suffix is available. */

MISRA-C [1998:2004] Function Definition: rule18

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 19: Required */

/* Octal constants ( other than zero ) shall not be used. */

MISRA-C [1998:2004] Function Definition: rule19

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 20: Required */

/* All object and function identifiers shall be declared before use. */

MISRA-C [1998:2004] Function Definition: rule20

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 21: Required */

/* Identifiers in an inner scope shall not mask identifiers in an */

/* outer scope. */

MISRA-C [1998:2004] Function Definition: func21
MISRA-C [1998:2004] Function Definition: func21a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 22: Advisory */

/* Declarations should be at function scope unless a wider scope is */

/* necessary. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 23: Advisory */

/* All declarations at file scope should be static where possible. */

MISRA-C [1998:2004] Function Definition: func23
MISRA-C [1998:2004] Function Definition: rule23

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 24: Required */

/* Identifiers shall not have internal and external linkage */

/* simultaneously in the same translation unit. */

MISRA-C [1998:2004] Function Definition: rule24

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 25: Required */

/* An identifier with external linkage shall have exactly one */

/* external definition. */

/* The use of rule24 ( ) is deliberate below. There is another one */

/* elsewhere. The checking tool should find this if it sees the */

/* whole of the compliance suite at once. */

MISRA-C [1998:2004] Function Definition: rule24

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 26: Required */

/* If objects are declared more than once they shall be declared */

/* compatibly. */

/* See also rule 27 for xi declaration. */

/* The use of rule24 ( ) is deliberate below. There is another one */

/* elsewhere. The checking tool should find this if it sees the */

/* whole of the compliance suite at once. The other one is defined as */

/* type SI_32. */

MISRA-C [1998:2004] Function Definition: rule24

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 27: Advisory */

/* Objects should be declared as extern in only one file. */

/* xi is also declared extern in misra_r26.c */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 28: Required */

/* The register storage class should not be used. */

/* The use of rule24 ( ) is deliberate below. There is another one */

/* elsewhere. The checking tool should find this if it sees the */

/* whole of the compliance suite at once. The other one is defined as */

/* type SI_32. */

MISRA-C [1998:2004] Function Definition: rule28

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 29: Required */

/* The use of a tag should be consistent with the declaration. */

/* This is covered by Rule 1. */

MISRA-C [1998:2004] Function Definition: f29

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 30: Required */

/* All automatic variables shall have been assigned a value before */

/* being used. */

/* This is not automatically detectable statically in all cases but */

/* the following should exercise a tool. */

/* The use of rule24 ( ) is deliberate below. There is another one */

/* elsewhere. The checking tool should find this if it sees the */

/* whole of the compliance suite at once. The other one is defined as */

/* type SI_32. */

MISRA-C [1998:2004] Function Definition: rule28

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 31: Required */

/* Braces shall be used to indicate and match the structure in the */

/* non-zero initialisation of arrays and structures. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 32: Required */

/* In an enumerator list, the '=' construct shall not be used to */

/* explicitly initialise members other than the first, unless all */

/* items are explicitly initialised. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 33: Required */

/* The right hand side of a && or || operator shall not contain */

/* side-effects. */

/* This is not automatically detectable statically in all cases but */

/* the following should exercise a tool. */

MISRA-C [1998:2004] Function Definition: rule33

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 34: Required */

/* The operands of a logical && or || shall be primary expressions. */

MISRA-C [1998:2004] Function Definition: rule34

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 35: Required */

/* Assignment operators shall not be used in expressions which return */

/* Boolean values. */

MISRA-C [1998:2004] Function Definition: rule35

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 36: Advisory */

/* Logical operators should not be confused with bitwise operators. */

/* Not automatically enforceable. Requires manual inspection techniques. */

MISRA-C [1998:2004] Function Definition: main

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 37: Required */

/* Bitwise operations shall not be performed on signed integer types. */

MISRA-C [1998:2004] Function Definition: rule37

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 38: Required */

/* The right hand operand of a shift operator shall lie between zero */

/* and one less than the width in bits of the left hand operand */

/* ( inclusive ) . */

MISRA-C [1998:2004] Function Definition: rule38

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 39: Required */

/* The unary minus operator shall not be applied to an unsigned */

/* expression. */

MISRA-C [1998:2004] Function Definition: rule39

/* error - Test failed. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 40: Advisory */

/* The sizeof operator should not be used on expressions that contain */

/* side effects. */

MISRA-C [1998:2004] Function Definition: rule40

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 41: Advisory */

/* The implementation of integer division in the chosen compiler */

/* should be determined, documented and taken into account. */

/* This is not enforceable but there are some troublesome cases which */

/* are worth flagging if the static analyser is sufficiently */

/* sophisticated. */

MISRA-C [1998:2004] Function Definition: rule41

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 42: Required */

/* The comma operator shall not be used, except in the control */

/* expression of a for loop. */

MISRA-C [1998:2004] Function Definition: rule42

/* DO NOTHING */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 43: Required */

/* Implicit conversions which may result in a loss of information */

/* shall not be used. */

MISRA-C [1998:2004] Function Definition: rule43

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 44: Advisory */

/* Redundant explicit casts should not be used. */

MISRA-C [1998:2004] Function Definition: rule44

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 45: Required */

/* Type casting from any type to or from pointers shall not be used. */

MISRA-C [1998:2004] Function Definition: rule45

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 46: Required */

/* The value of an expression shall be the same under any order of */

/* evaluation that the standard permits. */

MISRA-C [1998:2004] Function Definition: func46a
MISRA-C [1998:2004] Function Definition: rule46

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 47: Required */

/* No dependence should be placed on C's operator precedence rules in */

/* expressions. */

MISRA-C [1998:2004] Function Definition: rule47

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 48: Advisory */

/* Mixed precision arithmetic should use explicit casting to generate */

/* the desired result. */

/* Not automatically detectable statically in all cases. The */

/* following should give an indication. */

MISRA-C [1998:2004] Function Definition: rule48

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 49: Advisory */

/* Tests of a value against zero should be made explicit, unless the */

/* operator is effectively Boolean. */

/* Not automatically detectable statically in all cases. Tools can */

/* either warn on all or no occurrences in general. */

MISRA-C [1998:2004] Function Definition: rule49

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 50: Required */

/* Floating point variables shall not be tested for exact equality or */

/* inequality. */

MISRA-C [1998:2004] Function Definition: rule50

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 51: Advisory */

/* Evaluation of constant unsigned integer expressions should not lead */

/* to wrap-around. */

/* # error */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 52: Required */

/* There shall be no unreachable code. */

MISRA-C [1998:2004] Function Definition: rule52

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 53: Required */

/* All non-null statements shall have a side-effect. */

MISRA-C [1998:2004] Function Definition: rule53

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 54: Required */

/* A null statement shall only occur on a line by itself, and shall */

/* not have any other text on the same line. */

MISRA-C [1998:2004] Function Definition: rule54

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 55: Advisory */

/* Labels should not be used, except in switch statements. */

MISRA-C [1998:2004] Function Definition: rule55

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 56: Required */

/* The goto statement shall not be used. */

MISRA-C [1998:2004] Function Definition: rule56

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 57: Required */

/* The continue statement shall not be used. */

MISRA-C [1998:2004] Function Definition: rule57

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 58: Required */

/* The break statement shall not be used ( except to terminate the */

/* cases of a switch statement ) . */

MISRA-C [1998:2004] Function Definition: rule58

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 59: Required */

/* The statements forming the body of an if, else if, else, while, do */

/* ... while or for statement shall always be enclosed in braces. */

MISRA-C [1998:2004] Function Definition: rule59

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 60: Advisory */

/* All if, else if constructs should contain a final else clause. */

MISRA-C [1998:2004] Function Definition: rule60

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 61: Required */

/* Every non-empty case clause in a switch statement shall be */

/* terminated with a break statement. */

MISRA-C [1998:2004] Function Definition: rule61

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 62: Required */

/* All switch statements should contain a final default clause. */

MISRA-C [1998:2004] Function Definition: rule62

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 63: Advisory */

/* A switch expression should not represent a Boolean value. */

MISRA-C [1998:2004] Function Definition: rule63

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 64: Required */

/* Every switch statement shall have at least one case. */

MISRA-C [1998:2004] Function Definition: rule64

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 65: Required */

/* Floating point variables shall not be used as loop counters. */

MISRA-C [1998:2004] Function Definition: rule65

/* DO NOTHING */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 66: Advisory */

/* Only expressions concerned with loop control should appear within a */

/* for statement. */

/* This is in general difficult to detect automatically and statically. */

/* The following gives a simple case. */

MISRA-C [1998:2004] Function Definition: rule66

/* DO NOTHING */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 67: Advisory */

/* Numeric variables being used within a for loop for iteration */

/* counting should not be modified in the body of the loop. */

/* This is in general difficult to detect automatically and statically. */

/* The following gives a simple case. */

MISRA-C [1998:2004] Function Definition: func67
MISRA-C [1998:2004] Function Definition: rule67

/* Arg passed by value */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 68: Required */

/* Functions shall always be declared at file scope. */

MISRA-C [1998:2004] Function Definition: rule68

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 69: Required */

/* Functions with variable numbers of arguments shall not be used. */

MISRA-C [1998:2004] Function Definition: rule69

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 70: Required */

/* Functions shall not call themselves either directly or indirectly. */

/* It is trivial to detect direct recursion, but it can in some cases */

/* be impossible to detect indirect recursion statically. */

MISRA-C [1998:2004] Function Definition: rule70

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 71: Required */

/* Functions shall always have prototype declarations and the */

/* prototype shall be visible at both the function definition and the */

/* call. */

MISRA-C [1998:2004] Function Definition: rule71

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 72: Required */

/* For each function parameter the type given in the declaration and */

/* definition shall be identical, and the return types shall also be */

/* identical. */

MISRA-C [1998:2004] Function Definition: func72a
MISRA-C [1998:2004] Function Definition: func72b
MISRA-C [1998:2004] Function Definition: func72c

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 73: Required */

/* Identifiers shall be given either for all of the parameters in a */

/* function prototype declaration or for none. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 74: Required */

/* If identifiers are given for any of the parameters, then the */

/* identifiers used in the declaration and definition shall be */

/* identical. */

MISRA-C [1998:2004] Function Definition: func74a
MISRA-C [1998:2004] Function Definition: func74b

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 75: Required */

/* Every function shall have an explicit return type. */

MISRA-C [1998:2004] Function Definition: func75a
MISRA-C [1998:2004] Function Definition: func75b

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 76: Required */

/* Functions with no parameters shall be declared with parameter type */

/* void. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 77: Required */

/* The unqualifed type of parameters passed to a function shall be */

/* compatible with the unqualified expected types defined in the */

/* function prototype. */

MISRA-C [1998:2004] Function Definition: func77c

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 78: Required */

/* The number of parameters passed to a function shall match the */

/* function prototype. */

MISRA-C [1998:2004] Function Definition: func78c

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 79: Required */

/* The values returned by void functions shall not be used. */

MISRA-C [1998:2004] Function Definition: func79c

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 80: Required */

/* Void expressions shall not be passed as function parameters. */

MISRA-C [1998:2004] Function Definition: func80c

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 81: Advisory */

/* const qualification should be used on function parameters which are */

/* passed by reference, where it is intended that the function will */

/* not modify the parameter. */

/* Not statically enforceable. It is very difficult in practice to */

/* divine this intent automatically. */

MISRA-C [1998:2004] Function Definition: myfunction
MISRA-C [1998:2004] Function Definition: myfunction1

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 82: Advisory */

/* A function should have a single point of exit. */

MISRA-C [1998:2004] Function Definition: func82a
MISRA-C [1998:2004] Function Definition: func82b
MISRA-C [1998:2004] Function Definition: func82c

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 83: Required */

/* For functions with non-void return type: */

/* i ) there shall be one return statement for every exit */

/* branch ( including the end of the program ) , */

/* ii ) each return shall have an expression, */

/* iii ) the return expression shall match the declared return */

/* type. */

MISRA-C [1998:2004] Function Definition: func83a

/* return; */

MISRA-C [1998:2004] Function Definition: func83b
MISRA-C [1998:2004] Function Definition: func83c
MISRA-C [1998:2004] Function Definition: func83d

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 84: Required */

/* For functions with void return type, return statements shall not */

/* have an expression. */

MISRA-C [1998:2004] Function Definition: func84a
MISRA-C [1998:2004] Function Definition: func84b

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 85: Advisory */

/* Functions called with no parameters should have empty parentheses. */

MISRA-C [1998:2004] Function Definition: func85a
MISRA-C [1998:2004] Function Definition: func85b

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 86: Advisory */

/* If a function returns error information, then that error */

/* information shall be tested. */

/* Not statically enforceable. The method of testing is not */

/* sufficiently well-defined. */

MISRA-C [1998:2004] Function Definition: m86

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 87: Required [ 2004 adv ] */

/* 19.1 ADV #include statements in a file shall only be preceded by other */

/* pre-processor directives or comments. */

/* 8.5 No defn's in a header file */

MISRA-C [1998:2004] Function Definition: func87a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 88: Required */

/* Non-standard characters shall not occur in header file names in */

/* #include directives. */

/* RULE 88 */

/* RULE 88 */

/* RULE 88 */

/* * RULE 88 */

/* RULE 88 */

/* RULE 88 */

/* * RULE 88 */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* misra rule 89 #include include must be one of the following two forms */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 90: Required */

/* C macros shall only be used for symbolic constants, function-like */

/* macros, type qualifiers and storage class specifiers. */

/* RULE 90 */

MISRA-C [1998:2004] Function Definition: func90a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 91: Required */

/* Macros shall not be #defined'd and #undef'd in a block. */

MISRA-C [1998:2004] Function Definition: func91a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 92: Advisory */

/* #undef should not be used. */

MISRA-C [1998:2004] Function Definition: func92a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 93: Advisory */

/* A function should be used in preference to a function-like macro */

MISRA-C [1998:2004] Function Definition: func93a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 94: Required */

/* A function-like macro shall not be 'called' without all its */

/* arguments. */

MISRA-C [1998:2004] Function Definition: func94a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 95: Required */

/* Arguments to a function-like macro shall not contain tokens that */

/* look like pre-processing directives. */

MISRA-C [1998:2004] Function Definition: func95a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 96: Required */

/* In the definition of a function-like macro the whole definition, */

/* and each instance of a parameter, shall be enclosed in parentheses. */

MISRA-C [1998:2004] Function Definition: func96

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 97: Advisory */

/* Identifiers in pre-processor directives should be defined before */

/* use. */

MISRA-C [1998:2004] Function Definition: func97

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 98: Required */

/* At most one of # or ## in a single macro definition */

MISRA-C [1998:2004] Function Definition: func98

/* SC_8 msg2[] = STRINGS ( Hello, World ) ; */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 99: Required */

/* All uses of the #pragma directive shall be documented and */

/* explained. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 100: Required */

/* The defined pre-processor operator shall only be used in one of the */

/* two standard forms. */

MISRA-C [1998:2004] Function Definition: func100

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 101: Advisory */

/* Pointer arithmetic should not be used. */

MISRA-C [1998:2004] Function Definition: func101

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 102: Advisory */

/* No more than 2 levels of pointer indirection should be used. */

MISRA-C [1998:2004] Function Definition: func102

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 103: Required */

/* Relational operators shall not be applied to pointer types except */

/* where both operands are of the same type and point to the same */

/* array, structure or union. */

MISRA-C [1998:2004] Function Definition: func103

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 104: Required */

/* Non-constant pointers to functions shall not be used. */

MISRA-C [1998:2004] Function Definition: func104a
MISRA-C [1998:2004] Function Definition: func104b
MISRA-C [1998:2004] Function Definition: func104

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 105: Required */

/* All the functions pointed by a single pointer function shall be */

/* identical in the number and type of parameters and the return type. */

MISRA-C [1998:2004] Function Definition: func105a
MISRA-C [1998:2004] Function Definition: func105b
MISRA-C [1998:2004] Function Definition: func105c
MISRA-C [1998:2004] Function Definition: func105

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 106: Required */

/* The address of an object with automatic storage shall not be */

/* assigned to an object which may persist after the object has ceased */

/* to exist. */

MISRA-C [1998:2004] Function Definition: func106a

/* Returns pointer to automatic array. */

MISRA-C [1998:2004] Function Definition: func106b

/* Returns actual value. */

MISRA-C [1998:2004] Function Definition: func106c

/* Returns pointer to automatic. */

MISRA-C [1998:2004] Function Definition: func106d

/* Returns pointer to static. */

MISRA-C [1998:2004] Function Definition: func106e

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 107: Required */

/* The NULL pointer shall not be dereferenced. */

/* This is not statically detectable in all cases. */

MISRA-C [1998:2004] Function Definition: func107

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 108: Required */

/* In the specification of a structure or union type, all members of */

/* the structure or union shall be fully specified. */

MISRA-C [1998:2004] Function Definition: func108

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 109: Required */

/* Overlapping variable storage shall not be used. */

MISRA-C [1998:2004] Function Definition: func109a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 110: Required */

/* Unions shall not be used to access the sub-parts of larger data */

/* types. */

/* This seems slightly odd as Rule 109 effectively precludes the use */

/* of unions at all. */

MISRA-C [1998:2004] Function Definition: func110

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 111: Required */

/* Bit fields shall only be defined to be of type unsigned int or */

/* signed int. */

MISRA-C [1998:2004] Function Definition: func111

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 112: Required */

/* Bit fields of type signed int shall be at least 2 bits long. */

MISRA-C [1998:2004] Function Definition: func112

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 113: Required */

/* All the members of a structure ( or union ) shall be named and shall */

/* only be accessed via their name. */

MISRA-C [1998:2004] Function Definition: func113

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 114: Required */

/* Reserved words and standard library function names shall not be */

/* redefined or undefined. */

/* Note the interaction with rule 92 on #undef. */

/* We do not look for reserved words here as most occurrences lead to */

/* syntax error. */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 115: Required */

/* Standard library function names shall not be reused. */

/* Same order as K&R II, appendix B. */

/* File operations */

/* now define the std's and cause a re-definition alert, aka misra-c:2004 20.2 */

MISRA-C [1998:2004] Function Definition: fopen
MISRA-C [1998:2004] Function Definition: freopen
MISRA-C [1998:2004] Function Definition: fflush
MISRA-C [1998:2004] Function Definition: fclose
MISRA-C [1998:2004] Function Definition: remove
MISRA-C [1998:2004] Function Definition: rename
MISRA-C [1998:2004] Function Definition: tmpfile
MISRA-C [1998:2004] Function Definition: tmpnam
MISRA-C [1998:2004] Function Definition: setvbuf
MISRA-C [1998:2004] Function Definition: setbuf

/* Formatted output. */

MISRA-C [1998:2004] Function Definition: fprintf
MISRA-C [1998:2004] Function Definition: printf
MISRA-C [1998:2004] Function Definition: sprintf
MISRA-C [1998:2004] Function Definition: vprintf
MISRA-C [1998:2004] Function Definition: vfprintf
MISRA-C [1998:2004] Function Definition: vsprintf

/* Formatted input. */

MISRA-C [1998:2004] Function Definition: fscanf
MISRA-C [1998:2004] Function Definition: scanf
MISRA-C [1998:2004] Function Definition: sscanf

/* Character Input and Output functions */

MISRA-C [1998:2004] Function Definition: fgetc
MISRA-C [1998:2004] Function Definition: fgets
MISRA-C [1998:2004] Function Definition: fputc
MISRA-C [1998:2004] Function Definition: fputs

/* Direct Input and Output functions */

/* File positioning functions */

/* Error functions */

/* Character class tests */

/* String functions */

/* Mathematical functions */

/* Utility functions */

/* Non-local Jumps */

/* Signals */

/* Date and time functions */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 116: Required */

/* All libraries used in production code shall be written to comply */

/* with the provisions of this document, and shall have been subject */

/* to appropriate validation. */

/* Not automatically enforceable by a simple rule. */

/* verify that the prototypes agree with the stdlib's misra-c:2004 3.6 */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 117: Required */

/* The validity of values passed to library functions shall be */

/* checked. */

/* Not automatically enforceable by a simple rule although there are */

/* some examples which are worth checking. */

MISRA-C [1998:2004] Function Definition: func117

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 118: Required */

/* Dynamic heap memory allocation shall not be used. */

MISRA-C [1998:2004] Function Definition: func118

/* Doubly dangerous */

/* pd might move */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 119: Required */

/* The error indicator errno shall not be used. */

MISRA-C [1998:2004] Function Definition: func119

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 120: Required */

/* The macro offsetof shall not be used. */

MISRA-C [1998:2004] Function Definition: func120

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 121: Required */

/* and the setlocale function shall not be used. */

MISRA-C [1998:2004] Function Definition: func121

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 122: Required */

/* The setjmp macro and the longjmp function shall not be used. */

MISRA-C [1998:2004] Function Definition: func122

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 123: Required */

/* The signal handling facilities of shall not be used */

MISRA-C [1998:2004] Function Definition: func123a
MISRA-C [1998:2004] Function Definition: func123

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 124: Required */

/* output header file must not be used. */

/* ( The standards says library, but this is a header file containing */

/* o functions amongst other things. ) */

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 125: Required */

/* The library functions atof, atoi and atol from header file */

/* shall not be used. */

MISRA-C [1998:2004] Function Definition: func125a

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 126: Required */

/* The library functions abort, exit, getenv and system from */

/* shall not be used. */

MISRA-C [1998:2004] Function Definition: func126

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


/* Misra C Enforcement Testing */

/* Rule 127: Required */

/* The time handling functions of shall not be used. */

MISRA-C [1998:2004] Function Definition: func127

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.


Abraxas/Misra Home  Table of Contents  MISRA is a registered trademark of www.misra.uk.org 

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.