Cppcheck v1.73.
There are two source files:
c:\cppcheckTest\file1.c
void* myMalloc1( void ); void* myMalloc2( void ); void* myMalloc1( void ) { return myMalloc2( ); }
c:\cppcheckTest\file2.c
#include <stdlib.h> void* myMalloc2( void ); /* comment? */ void* myMalloc2( void ) { return malloc( 100 ); }
When analyzing file1.c with "--append=file2.c" parameter, cppcheck reports "Syntax Error" at output.
Command line:
cppcheck --template=gcc --inline-suppr --quiet --enable=all C:\cppcheckTest\file1.c --append=c:\cppcheckTest\file2.c
Cppcheck output:
C:\cppcheckTest\file1.c:13: error: Syntax Error: AST broken, ternary operator lacks ':'.
Let's modify c:\cppcheckTest\file2.c file (question mark in comment is deleted):
#include <stdlib.h> void* myMalloc2( void ); /* comment */ void* myMalloc2( void ) { return malloc( 100 ); }
C:\cppcheckTest\file1.c:4: style: The function 'myMalloc1' is never used.
Seems like cppcheck consider comments in appended source files NOT to be a comment, but normal code. Why?
Log in to post a comment.
Cppcheck v1.73.
There are two source files:
c:\cppcheckTest\file1.c
c:\cppcheckTest\file2.c
When analyzing file1.c with "--append=file2.c" parameter, cppcheck reports "Syntax Error" at output.
Command line:
Cppcheck output:
Let's modify c:\cppcheckTest\file2.c file (question mark in comment is deleted):
Cppcheck output:
Seems like cppcheck consider comments in appended source files NOT to be a comment, but normal code. Why?
Last edit: Anton Drap 2016-06-01