MISRA C:2012

MISRA C:2012

Tool

Version

PC-Lint

V9.00L

Violations

Total

Violations

Total

Required Directives

0

Required Rules

8

Advisory Directives

1

Advisory Rules

7

Directive

Type

Rationale

PC-Lint Results

Directive

Type

Rationale

PC-Lint Results

1.1

Required

 

2.1

Required

 

3.1

Required

 

4.1

Required

 

4.2

Advisory

 

4.3

Required

 

4.4

Advisory

 

4.5

Advisory

 

4.6

Advisory

 

4.7

Required

 

4.8

Advisory

 

4.9

Advisory

  1. Function-like macros are used instead of functions for several reasons in uC/OS-III. They improve code clarity without increasing overhead for bitwise operations. Additionally, operations such as disabling interrupts and context switching can be optimized by the port developer since they need not incur the overhead of a function call. This style of macro also provides a clean way to add hooks for external instrumentation.

4.10

Required

 

4.11

Required

 

4.12

Required

 

4.13

Advisory

 

Rule

Type

Rationale

PC-Lint Results

Rule

Type

Rationale

PC-Lint Results

1.1

Required

 

1.2

Advisory

 

1.3

Required

 

2.1

Required

  1. The DEF_BIT_IS_SET(val, mask) and DEF_BIT_IS_CLR(val, mask) macros check to see if mask is 0 in order to return the proper value. Since mask is often a #define constant in the context of uC/OS-III, the expression is a constant value boolean.

  2. DEF_BIT_FIELD(bit_field, bit_shift) is used to calculate the threshold value for detecting if a delay has completed before the task was added to the tick list. The threshold value, OS_TICK_TH_RDY, is purely a function of the size of the OS_TICK datatype and is evaluated at compile-time. The boolean expression in DEF_BIT_FIELD(bit_field, bit_shift) will therefore be a constant-value boolean.

2.2

Required

 

2.3

Advisory

  1. All kernel types are defined regardless of the kernel features which are enabled. Some types will be unused in certain kernel configurations or are unused but remain in the code for legacy reasons.

2.4

Advisory

  1. The uC/OS-III coding standard requires that all structs have a tag as well as a  type name. However, only the type names may be used in the code. Therefore,  the struct tags remain unused outside of typedefs.

2.5

Advisory

  1. Certain macros are defined for application use, debugging use, or as required by the coding standards. Others are present for backwards-compatibility with older software. These macros may not be referenced by the kernel code in some or all circumstances.

2.6

Advisory

 

2.7

Advisory

 

3.1

Required

 

3.2

Required

 

4.1

Required

 

4.2

Advisory

 

5.1

Required

 

5.2

Required

 

5.3

Required

 

5.4

Required

 

5.5

Required

 

5.6

Required

 

5.7

Required

 

5.8

Required

 

5.9

Advisory

 

6.1

Required

 

6.2

Required

 

7.1

Required

 

7.2

Required

 

7.3

Required

 

7.4

Required

 

8.1

Required

 

8.2

Required

 

8.3

Required

 

8.4

Required

  1. Global variables for uC/OS-III are declared in os.h using the OS_EXT macro as a qualifier. If a file defines OS_GLOBALS before including os.h, the macro is empty and the globals are defined in that file; otherwise, the macro resolves to "extern". This approach provides a simple way to declare and define global variables without duplicating code. However, with this approach the file which defines OS_GLOBALS, os_var.c, will not  have any extern declarations.

8.5

Required

 

8.6

Required

 

8.7

Advisory

 

8.8

Required

 

8.9

Advisory

 

8.10

Required

 

8.11

Advisory

 

8.12

Required

 

8.13

Advisory

 

8.14

Required

 

9.1

Mandatory

 

9.2

Required

 

9.3

Required

 

9.4

Required

 

9.5

Required

 

10.1

Required

 

10.2

Required

 

10.3

Required

 

10.4

Required

 

10.5

Advisory

 

10.6

Required