simplify asm labels
Fixes cppcheck 2.7 regression and adds support for proper (i hope) asm labels processing (https://gcc.gnu.org/onlinedocs/gcc/Asm-Labels.html).
How it looks in cppcheck 2.7:
$ cppcheck asmlabel.c
Checking asmlabel.c ...
asmlabel.c:2:7: error: There is an unknown macro here somewhere. Configuration is required. If func is a macro then please configure it. [unknownMacro]
void* func() asm ("myfunc") ;
^
$ cat asmlabel.c
int* pfoo asm ("pmyfoo") = NULL;
void* func() asm ("myfunc") ;
$ cppcheck --debug asmlabel.c
Checking asmlabel.c ...
##file asmlabel.c
1: int * pfoo asm ( ""pmyfoo"" ) ; = NULL ;
2: void * func ( ) asm ( ""myfunc"" ) ;
##Value flow
asmlabel.c:2:7: error: There is an unknown macro here somewhere. Configuration is required. If func is a macro then please configure it. [unknownMacro]
void* func() asm ("myfunc") ;
Well.. Have to find a way to distinguish asm label from asm inline. For example, testsuite failure @ test/testother.cpp:4810 shows that just analyzing adjacent tokens is not enough.
( test/testother.cpp:4810)
check("void f() {\n"
" if (b)\n"
" __asm__(\"mov ax, bx\");\n"
" else\n"
" __asm__(\"mov ax, bx\");\n"
"}");
ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:2]: (style, inconclusive) Found duplicate branches for 'if' and 'else'.\n", errout.str());
Baffled by "format / build" check failure. Log message:
2022-02-13T12:13:15.7455536Z FAIL: lib/tokenize.cpp (File size changed from 491084 to 491087
All formatting (indents, braces etc) seems to be identical to existing code.
Any ideas?
Baffled by "format / build" check failure. Log message:
2022-02-13T12:13:15.7455536Z FAIL: lib/tokenize.cpp (File size changed from 491084 to 491087All formatting (indents, braces etc) seems to be identical to existing code. Any ideas?
You should run uncrustify and compare its output to your tokenize.cpp.
Baffled by "format / build" check failure. Log message:
2022-02-13T12:13:15.7455536Z FAIL: lib/tokenize.cpp (File size changed from 491084 to 491087All formatting (indents, braces etc) seems to be identical to existing code. Any ideas?You should run
uncrustifyand compare its output to yourtokenize.cpp.
Thanks a lot, it helped (found one missing space in indents). It's a pity that diff between original and "uncrustified" file isn't shown in job logs.