Menu

Variable 'pthread_mutex_t' is unknown

6 days ago
6 days ago
  • Inderjit Singh

    Inderjit Singh - 6 days ago

    Hi.

    I don't seem to be able to get out of this problem.

    In my file queue.h I have declared:

    #include <pthread.h> 
    
    #define Q_HDR_INT_SZ    4
    #define Q_HDR_SZ        (sizeof(pthread_mutex_t) + Q_HDR_INT_SZ)
    

    When using the macro, I get:

    Variable 'pthread_mutex_t' is unknown
    

    Anyone can guide me to why this error is being generated and to fix it?

     
  • CHR

    CHR - 6 days ago

    Is the output really generated by cppcheck? I can't reproduce this with the code above.

     
  • Inderjit Singh

    Inderjit Singh - 6 days ago

    Sorry CHR. I realised was say too brief in the description. Here is a more detailed output:

    cppcheck version: 2.13.0

    $ cppcheck --addon=test/pipeline/coding_stds/misra.json --error-exitcode=255 -I/home/user/devel/repos/project/common/src/utils /home/user/devel/common/src/comp/comp_queue.c

    And the result:

    .
    .
    .
    Checking project/common/src/comp/comp_queue.c: SYSCFG_COMP_USE...
    
    project/common/src/comp/comp_queue.c:284:10: error: Variable 'pthread_mutex_t' is unknown [misra-config]
        if ((Q_HDR_SZ+(Q_ELEM_HDR_SZ+pkt_sz)*inbuf_cap) != inbuf_sz)
             ^
    project/common/src/comp/comp_queue.c:291:10: error: Variable 'pthread_mutex_t' is unknown [misra-config]
        if ((Q_HDR_SZ+(Q_ELEM_HDR_SZ+pkt_sz)*outbuf_cap) != outbuf_sz)
             ^
    .
    .
    .
    

    And queue.h is in the /home/user/devel/repos/project/common/src/utils directory

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.