zephyr/scripts/coccinelle/ignore_return.cocci
Flavio Ceolin 8f3459b3db coccinelle: Updating ignore_return to support memcpy
The return of memcpy was being ignored just like memset's return. Just
adding it to coccinelle script.

MISRA-C rule 17.7

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-19 14:37:25 +01:00

23 lines
434 B
Plaintext

/// Cast void to memset to ignore its return value
///
//# The return of memset and memcpy is never checked and therefore
//# cast it to void to explicitly ignore while adhering to MISRA-C.
//
// Confidence: High
// Copyright (c) 2017 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
virtual patch
@depends on patch && !(file in "ext")@
expression e1,e2,e3;
@@
(
+ (void)
memset(e1,e2,e3);
|
+ (void)
memcpy(e1,e2,e3);
)