Menu

Pre-processor symbol when cppcheck is active

2024-06-25
2024-06-28
  • Richard Smith

    Richard Smith - 2024-06-25

    I'd like to detect in the source code when cppcheck is active. Does the cppcheck pre-processor create any symbols that indicate its processing the source code?

     
  • Daniel Marjamäki

    you mean that we would pre-define __cppcheck__ or something like that. No Cppcheck does not do that currently.

     
  • Richard Smith

    Richard Smith - 2024-06-28

    Ok. Thank you for the response.

    Yes, Something like __cppcheck__. Looking for some sort of indication that it is cppcheck processing the file and not the compiler. I would use it to deal with wanting to create some alternate versions of macros that are from a library outside of the code getting checked.

     
  • CHR

    CHR - 2024-06-28

    You could add a define to your cppcheck invocation with -D__cppcheck__.

     

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.