Menu

cppcheck syntax error with placed IAR symbol

Mark Dee
2018-05-12
2019-01-02
  • Mark Dee

    Mark Dee - 2018-05-12

    IAR uses the '@' symbol to specify the absolute address of data values (e.g. hardware registers). Anyone found a way to configure cppcheck to accept this construct. Here's a sample code snippet.

    __no_init static AT91S_DBGU s_Debug @ DEBUG_REG_ADDR;

    Thanks.

     
  • Daniel Marjamäki

    As far as I see you can't fix this by some configuration.

    I created this ticket:
    https://trac.cppcheck.net/ticket/8572

    If you have some time then feel free to look at how this can be solved in Cppcheck.

    I guess that it is ok to remove "@SOMEADDR" in such variable declarations. That can be done in our lib/tokenizer.cpp somewhere in Tokenizer::simplifyTokenList1().

     
  • Mark Dee

    Mark Dee - 2018-05-14

    In the ticket, amai provided links to a workaround. Rather than using the @ address notation, #pragma location= serves the same purpose and cppcheck is perfectly happy with it.

     

    Last edit: Mark Dee 2018-05-14
  • versat

    versat - 2018-05-16

    IIRC it is not IAR specific. I have seen this with the original ARM compiler too. It was at some place (i think a header file) where i can not or do not want to simply change it. So IMHO it would be nice if Cppcheck could handle this.

     
  • Daniel Marjamäki

    For information, this was fixed in Cppcheck-1.86. No workaround with pragma is needed.

     
  • Calvin Chan

    Calvin Chan - 2019-01-02

    not quite fully fixed. As seen from the following link:

    https://sourceforge.net/p/cppcheck/discussion/general/thread/8f618cb0a3/

    for case of array of variable at absolute address.

    Calvin

     

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.