Inderjit Singh - 2025-02-06

I am running cppcheck version 2.13.0 on Ubuntu 24.04 (x84_64) for a C project.

It seems including directories for header files containing declarations from an open sourced library that is used by our software doesn't seem to work. I have triple checked path existence and its relative path and can confirm they are correct yet still it doesn't find the Variables as errors are thrown.

For example, in file project/common/lib/pus/fp-1.0/include/pus_error.h, the variable PUS_NO_ERROR is defined as shown under declaration/error below.
Same issue with other is for the other header files, see error below:

Any idea why it's throwing the error?

Thanks in advance,
Inderjit

declaration:

//! Type for the internal PUS library error codes                                                                      
typedef enum
{
    PUS_NO_ERROR = 0,             <----------- Definition
    PUS_ERROR_NULLPTR,
.
.
.
   // Limit
   PUS_LAST_ERROR
} pusError_t;

Error:

Checking project/common/src/protocols/pus/pus_pkt_handler.c ...
Defines:
Undefines:
Includes: -Iproject/common/src/include/ -Iproject/sb/src/config/ -Iproject/common/lib/pus/fp-1.0/include/ -Iproject/common/lib/pus/fp-1.0/asn1_parsed/
Platform:native
Checking project/common/src/protocols/pus/pus_pkt_handler.c: SYSCFG_PROTO_PUS_USE...
project/common/src/protocols/pus/pus_pkt_handler.c:95:35: error: Variable 'pus_TM' is unknown [misra-config]
    if (pus_getPacketType(pkt) != pus_TM)
                                  ^
project/common/src/protocols/pus/pus_pkt_handler.c:175:21: error: Variable 'ERR_UPER_DECODE_PUSINT64' is unknown [misra-config]
            (err != ERR_UPER_DECODE_PUSINT64) &&
                    ^
project/common/src/protocols/pus/pus_pkt_handler.c:176:21: error: Variable 'ERR_PUSTCAPPLICATIONDATA' is unknown [misra-config]
            (err != ERR_PUSTCAPPLICATIONDATA))
                    ^
project/common/src/protocols/pus/pus_pkt_handler.c:185:37: error: Variable 'asn1Sccpus_TC' is unknown [misra-config]
    if ((pus_getPacketType(&pkt) == asn1Sccpus_TC) &&
                                    ^
project/common/src/protocols/pus/pus_pkt_handler.c:192:20: error: Variable 'PUS_NO_ERROR' is unknown [misra-config]
        if (err != PUS_NO_ERROR)                      <------------ Fails