Menu

False positive: syntax error

figaro_
2023-11-23
2023-11-27
  •  figaro_

    figaro_ - 2023-11-23

    The command man timercmp lists the construct as valid, hence I believe this to be a false positive:

    vely-master/fcli.c:494:42: error: syntax error: <) [syntaxError]
      if (timercmp (&elapsed, &(fc_l->tout), < )) {
                                             ^
    

    To replicate:

    wget https://github.com/velydev/vely/archive/refs/heads/master.zip
    unzip -q master.zip
    cppcheck -i v1.c --enable=all --output-file=vely.cppcheck vely-master/
    grep -C2 "error:" vely.cppcheck 
    

    Not sure why the -i v1.c is necessary, perhaps it is an infinite recursion.

    Cppcheck 2.7 on Ubuntu 22.04.

     

    Last edit: figaro_ 2023-11-23
  • CHR

    CHR - 2023-11-27

    You probably need to pass --library=gnu.

     
  •  figaro_

    figaro_ - 2023-11-27

    Ok, thanks, that works. I did not see this in the manual.

     
  • CHR

    CHR - 2023-11-27

    The corresponding section in the manual is not all that helpful, see https://trac.cppcheck.net/ticket/12225

     

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.