Menu

Cppcheck dump macro information from token

samed
2021-08-26
2021-08-27
  • samed

    samed - 2021-08-26

    Is it possible to check if a token is macro or not in the dump file? For example TEST_F macro from googletest is considered a function currently (version 2.1). It might resolve into a function but I would like to be able to see that it is also a macro.

     

    Last edit: samed 2021-08-26
  • Daniel Marjamäki

    For example TEST_F macro from googletest is considered a function currently

    I would appreciate if you investigate this a little bit..

    In the cfg file googletest.cfg cppcheck can see that TEST_F is a macro.

    Then the Token::isExpandedMacro() should return true for TEST_F resulting token.

    Then a isExpandedMacro="true" should be written in the dump file.

    Where is this broken.

     

    Last edit: Daniel Marjamäki 2021-08-26
  • samed

    samed - 2021-08-27

    Yep, that works. Normal macros automatically show isExpandedMacro="true" in the dump file. Why does TEST_F require a .cfg file?

     
  • Daniel Marjamäki

    Why does TEST_F require a .cfg file?

    you can try to include the system includes if you want but there are drawbacks. in the cfg files there are lots of information that is not available in the headers so cppcheck can find plenty of memory errors etc that will be missed if you just include the headers.

     

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.