How can I tell cppcheck to ignore inline assembly?

Viewed 735

We have a file within inline assembly for a DSP. Cppcheck thinks there are a load of "variable assigned but not used" lines in the assembly.

Is there any way to tell it to skip checking the inline assembly sections? I couldn't see anything obvious in the manual, and it is a bit tedious to have to suppress each line in turn (t

Here's an example of some of the the offending lines. It's a context save routine.

inline assembly void save_ctx()
{
asm_begin
.undef global data saved_ctx; 
.undef global data p_ctx;  
asm_text
    ...
    st XM[p0++], r0;
    st XM[p0++], r1;    
    st XM[p0++], r2;    
    st XM[p0++], r3;    
    st XM[p0++], r4;    
    st XM[p0++], r5;    
    st XM[p0++], r6;   
    ...

I can turn off the messages with // cppcheck-suppress unreadVariable before each line, but it would be better to just tell cppcheck to skip the whole inline assembly section.

Is there any way I can do this, or will we just have to accept lots of repeated comments?

2 Answers
Related