Menu

syntax error (on unknown macro?)

Martin
2020-10-12
2020-10-22
  • Martin

    Martin - 2020-10-12

    Hi,

    the latest cppcheck exits with a syntax error on this valid code:

    namespace v1 {
    int createEx1()
    {
    return 0;
    }
    INITIALIZER(registerEx1)
    {}
    }

    error: syntax error [syntaxError]
    INITIALIZER(registerEx1)

    This is (rather obscure looking) generated, buildable code from our codebase, with INITIALIZER being a macro defined somewhere else.
    Could you please check?

    Thanks,
    Martin

     
  • Daniel Marjamäki

    You need to configure that macro somehow. I would recommend in a library file. If you create some genivi-common-api.cfg that defines this INITIALIZER and whatever other features you think is useful, I will be happy to add that in the cppcheck repo and distribute it.

    in a library file you can provide additional information that is not available in normal headers. and get stronger cppcheck analysis than would be possible if cppcheck just used the header.

    if there is some functions that you use often that has some semantics, for instance allowed value range, allocates/deallocates memory / buffer size can be checked / buffer must be initialized / ... then feel free to ask how to configure that.

     

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.