Tool | Version |
---|
PC-Lint | V9.00L |
Violations | Total |
---|
Required Directives | 0 |
Required Rules | 8 |
Advisory Directives | 1 |
Advisory Rules | 7 |
Rule | Type | Rationale | PC-Lint Results |
---|
1.1 | Required | | |
1.2 | Advisory | | |
1.3 | Required | | |
2.1 | Required | - 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.
- 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 | - 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 | - 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 | - 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 | - 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 | | |
10.7 | Required | | |
10.8 | Required | | |
11.1 | Required | | |
11.2 | Required | | |
11.3 | Required | - uC/OS-III defines a number of kernel objects which may be pended on, such as semaphores, flags, and mutexes. Internally, the kernel manages all of these objects using pointers to a generic type, OS_PEND_OBJ. In order to do this each object is represented by a struct type which is a superset of the os_pend_obj struct type. When a pointer to a kernel object is passed to the appropriate Pend function, it is type cast to first to (void *) and then to (OS_PEND_OBJ *). The cast to (void *) is used to suppress MISRA Rule 1.3. Because of the overlap in the struct declarations, casts to (OS_PEND_OBJ *) maintain proper alignment and ensure that the common member variables can be legally accessed.
- Memory partitions are structured as a linked list of memory blocks. Maintaining this structure requires casting from (void *) to (void **) and vice versa when creating, adding and removing memory blocks to, or traversing the linked list.
| |
11.4 | Advisory | | |
11.5 | Advisory | - Casting from (void *) to other types is performed as described in 11.3
| |
11.6 | Required | - A pointer is cast to integer type in order to check for proper alignment.
| |
11.7 | Required | | |
11.8 | Required | | |
11.9 | Required | | |
12.1 | Advisory | | |
12.2 | Required | | |
12.3 | Required | | |
12.4 | Required | | |
13.1 | Required | | |
13.2 | Required | | |
13.3 | Advisory | | |
13.4 | Advisory | | |
13.5 | Required | | |
13.6 | Mandatory | | |
14.1 | Required | | |
14.2 | Required | | |
14.3 | Required | - An if statement uses an invariant boolean expression in order to determine the width of the architecture's pointer type at run-time. This is an optimization for checking pointer alignment on 8-bit architectures.
| |
14.4 | Required | | |
15.1 | Advisory | | |
15.2 | Required | | |
15.3 | Required | | |
15.4 | Advisory | | |
15.5 | Advisory | - uC/OS-III functions can return from several points before the end of their function block. This is a tightly integrated into the kernel's design and cannot be changed.
| |
15.6 | Required | | |
15.7 | Required | | |
16.1 | Required | - Certain switch statements use a return in the final switch case in lieu of an unconditional break. This is done to improve execution time and code clarity when returning from an error state.
| |
16.2 | Required | | |
16.3 | Required | - Certain switch statements use a return in the final switch case in lieu of an unconditional break. This is done to improve execution time and code clarity when returning from an error state.
| |
16.4 | Required | | |
16.5 | Required | | |
16.6 | Required | | |
16.7 | Required | | |
17.1 | Required | | |
17.2 | Required | | |
17.3 | Mandatory | | |
17.4 | Mandatory | | |
17.5 | Advisory | | |
17.6 | Mandatory | | |
17.7 | Required | | |
17.8 | Advisory | - In order to reduce the overall memory footprint and call stack size, some functions will modify their parameters rather than declare new variables.
| |
18.1 | Required | | |
18.2 | Required | Please see Note 1. | |
18.3 | Required | - A pointer comparison is used to check for a stack overflow when creating the initial stack frame for a new task.
| |
18.4 | Advisory | - Pointer arithmetic is used to calculate pointers to the individual memory blocks when creating memory partitions.
- Pointer arithmetic is used to calculate the stack limit when creating a task stack.
| |
18.5 | Advisory | | |
18.6 | Required | | |
18.7 | Required | | |
18.8 | Required | | |
19.1 | Mandatory | | |
19.2 | Advisory | | |
20.1 | Advisory | | |
20.2 | Required | | |
20.3 | Required | | |
20.4 | Required | | |
20.5 | Advisory | | |
20.6 | Required | | |
20.7 | Required | | |
20.8 | Required | | |
20.9 | Required | | |
20.10 | Advisory | | |
20.11 | Required | | |
20.12 | Required | | |
20.13 | Required | | |
20.14 | Required | | |
21.1 | Required | | |
21.2 | Required | | |
21.3 | Required | | |
21.4 | Required | | |
21.5 | Required | | |
21.6 | Required | | |
21.7 | Required | | |
21.8 | Required | | |
21.9 | Required | | |
21.10 | Required | | |
21.11 | Required | | |
21.12 | Advisory | | |
22.1 | Required | | |
22.2 | Mandatory | | |
22.3 | Required | | |
22.4 | Mandatory | | |
22.5 | Mandatory | | |
22.6 | Mandatory | | |
Note 1 - uC/OS-III uses a relational operator to compare pointers when checking for stack overflows.
This potentially violates rule 18.3 but not rule 18.2, which prohibits subtraction operators between pointers unless they point to elements of same array.
Because PC-Lint uses the same error message for both rules, a manual check should be made to verify that rule 18.3 is not violated.