using cppcheck v1.86 (Debian unstable) gives me headaches with errors
(and thus files beign skipped) with the attached file.
It says (wrongly):
The tested configurations have these preprocessor
errors:\012HAVE_CONFIG_H=1 : [gl/c-ctype.h:78] #error "Only ASCII and
EBCDIC are supported"
I have only added the options at the end: --enable=information -v --output-file=cppcheck_lib_output.txt
Neither with 1.86 nor with git head i was able to reproduce the issue.
I have attached the output files.
The only thing that does not look correct are these messages:
I would expect Cppcheck to always define __FILE__ and __LINE__.
But for code like this:
#ifdef __FILE__#ifdef __LINE__#define gnutls_assert() _gnutls_assert_log( "ASSERT: %s[%s]:%d\n", __FILE__,__func__,__LINE__);#else#define gnutls_assert()#endif#else /* __FILE__ not defined */#define gnutls_assert()#endifvoidf(){gnutls_assert();}
Cppcheck (1.86 and head) outputs this:
$ ./cppcheck --enable=information gnutls_assert.c
Checking gnutls_assert.c ...
[gnutls_assert.c:13]: (information) Skipping configuration '__FILE__' since the value of '__FILE__' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
Checking gnutls_assert.c: __FILE__...
[gnutls_assert.c:13]: (information) Skipping configuration '__FILE__;__LINE__' since the value of '__FILE__' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
[gnutls_assert.c:13]: (information) Skipping configuration '__FILE__;__LINE__' since the value of '__LINE__' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
Checking gnutls_assert.c: __FILE__;__LINE__...
Not sure if that is intended or useful.
Btw.: I recommend to also use the option --library=gnu for gnutls. It defines such things like unlikely(), likely() and other GNU stuff.
Hi,
using cppcheck v1.86 (Debian unstable) gives me headaches with errors
(and thus files beign skipped) with the attached file.
It says (wrongly):
The tested configurations have these preprocessor
errors:\012HAVE_CONFIG_H=1 : [gl/c-ctype.h:78] #error "Only ASCII and
EBCDIC are supported"
See also: https://gitlab.com/gnutls/gnutls/issues/705
Removing that part from the file and hard-coding C_CTYPE_ASCII works nicely.
Maybe there is a known work-around !? If not and you consider this a
bug, could someone file a bug in the issue tracker, please ?
Thanks so much for cppcheck ! Tim
BTW, the problematic part is
if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
/ The character set is ASCII or one of its variants or extensions, not
EBCDIC.
Testing the value of '\n' and '\r' is not relevant. /
define C_CTYPE_ASCII 1
elif ! (' ' == '\x40' && '0' == '\xf0' \
error "Only ASCII and EBCDIC are supported"
endif
can you try to format it better. There is a button that looks like
</>
that you use for code.when I check c-ctype.h I get no error. could you please try to create a small test case that reproduce the problem?
I downloaded gnutls-master.zip and copied the commands together to execute cppcheck manually:
I have only added the options at the end:
--enable=information -v --output-file=cppcheck_lib_output.txt
Neither with 1.86 nor with git head i was able to reproduce the issue.
I have attached the output files.
The only thing that does not look correct are these messages:
I would expect Cppcheck to always define
__FILE__
and__LINE__
.But for code like this:
Cppcheck (1.86 and head) outputs this:
Not sure if that is intended or useful.
Btw.: I recommend to also use the option
--library=gnu
for gnutls. It defines such things likeunlikely()
,likely()
and other GNU stuff.Last edit: versat 2019-02-15