Hi,
I have a C header that is used by both C and C++ code. The C header includes a C++ header for C++ code using the '__cplusplus' precompile:
#include "cpp_only_header.h"
But when I do a "c" check cppcheck --language=c my_c.c
I get an error of "cpp_only_header.h" using c++.
I use $ cppcheck --version Cppcheck 2.3
Any advice? Is this an issue?
Thanks Erez
a quick hack that should work:
cppcheck -U__cplusplus my_c.c
Is this an issue?
I think it's a little issue. I have created https://trac.cppcheck.net/ticket/10989
I can't reproduce any problems.
Can you give some more details?
The __cplusplus is skipped when I run this command:
__cplusplus
$ cppcheck 1.c Checking 1.c ... 1.h:8:10: error: Division by zero. [zerodiv] int y=100/0; ^
1.c:
#include "1.h"
1.h:
#ifdef __cplusplus int x = 100/0; #endif int y = 100/0;
Log in to post a comment.
Hi,
I have a C header that is used by both C and C++ code.
The C header includes a C++ header for C++ code using the '__cplusplus'
precompile:
ifdef __cplusplus
endif / __cplusplus /
But when I do a "c" check
cppcheck --language=c my_c.c
I get an error of "cpp_only_header.h" using c++.
I use
$ cppcheck --version
Cppcheck 2.3
Any advice?
Is this an issue?
Thanks
Erez
a quick hack that should work:
I think it's a little issue. I have created https://trac.cppcheck.net/ticket/10989
I can't reproduce any problems.
Can you give some more details?
The
__cplusplus
is skipped when I run this command:1.c:
1.h: