Menu

bad macro syntax

Müller
2018-11-23
2021-10-07
  • Müller

    Müller - 2018-11-23

    when I try to run cppcheck on a cmake project I get the following errors:

    Checking /home/user/builddir/cppcheck/externals/tinyxml/tinyxml2.cpp ...
    Bailing out from checking /home/user/builddir/cppcheck/externals/tinyxml/tinyxml2.cpp since there was an internal error: bad macro syntax
    1/53 files checked 1% done
    .
    .
    Checking /home/user/builddir/cppcheck/cli/threadexecutor.cpp ...
    Bailing out from checking /home/user/builddir/cppcheck/cli/threadexecutor.cpp since there was an internal error: bad macro syntax
    53/53 files checked 100% done
    

    to reproduce just run cmake on the cppcheck directory with
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
    and afterwards try

    cppcheck --project=compile_commands.json
    
     
  • Daniel Marjamäki

    Thanks for reporting this problem! I created this ticket: https://trac.cppcheck.net/ticket/8864

     
  • Daniel Marjamäki

    I fixed the ticket. But I am not sure the compile_commands will always be handled well. How is windows include paths working now? I have trouble testing this. If you can test it out please feel free to do it.

    Is it possible to reuse some compile_commands parser? The only open source parser I am aware of is the one built into clang. And that is probably bloated.

     
  • Müller

    Müller - 2018-11-28

    Your fix works for me. Thanky you.
    I don't know about windows include paths.

     
    • Daniel Marjamäki

      Great!

      I tried it on windows and it does not work well for me :-(

      For me when I generate a compile database using cmake in windows, it
      uses response files. I did not know about response files and have no
      handling for it. I am surprised nobody has complained, maybe these are
      not used much in windows. It's not easy to generate a compile database
      in windows, you can't just use the DOUTPUT_COMPILE_DATABASE you also
      need to use some specific generator. and a workaround if you use cmake
      is to generate the visual studio solution instead.

      Den ons 28 nov. 2018 kl 16:15 skrev "Müller" s1m3mu3@users.sourceforge.net:

      Your fix works for me. Thanky you.
      I don't know about windows include paths.


      bad macro syntax


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cppcheck/discussion/development/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • Stefan Büttner

    Stefan Büttner - 2021-10-07

    This still seems to be an issue in version 2.2.

    With

    target_compile_definitions(some_target
        PRIVATE
        -DSOME_VAR="foobar"
    )
    

    I get the error

    Bailing out from checking source.cpp since there was an internal error: bad macro syntax. macroname=SOME_VAR value=\"foobar\"
    

    I'm on Linux with cmake using cppcheck with the --project=compile_commands.json flag.

     

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.