splint

Why does Splint (the C code checker) give an error when comparing a float to an int?

Both are mathematical values, however the float does have more precision. Is that the only reason for the error - the difference in precision? Or is there another potential (and more serious) problem? ...

Addressing splint warnings about functions "not used" while they are passed as parameters

On a program of me, the splint checker warns: expat-test.c:23:1: Function exported but not used outside expat-test: start A declaration is exported, but not used outside this module. Declaration can use static qualifier. (Use -exportlocal to inhibit warning) expat-test.c:38:1: Definition of start The start() function is used. T...

What is the differences about struct in C99 to ANSI-C ?

Hello, This code doesn't appear to be correct in ANSI-C, but ok in C99 : struct a { int x; int y; } z; What are the differences about struct in C99 and ANSI-C ? Edit: I forgot the "a", my bad. This code compiles ok with gcc in C99 mode, but is a parse error on splint, which is known to not support all the C99 extensions. Edit2: here...

How can I make splint ignore where I declare my variables?

Hi Do you know how can I make splint ignore where I declare my variables? I know that the old school c tells you to declare variables right at the beginning in every function, but since I am a bad person I like to declare things close to where I use them. A good example is to put int i; right before the for(i=0;...). Let's take a v...

splint and test coverage analysis?

Hello C people. I'm looking for a static analysis tool with the maturity of splint that also produces test coverage analysis of the code. For instance, all non-static functions in libfoo.c should be present in libfoo.h, by that token all functions in libfoo.h should have unit tests. Of course, such behavior would need some kind of gran...

How does splint know my function isn't used in another file?

Splint gives me the following warning: encrypt.c:4:8: Function exported but not used outside encrypt: flip A declaration is exported, but not used outside this module. Declaration can use static qualifier. (Use -exportlocal to inhibit warning) encrypt.c:10:1: Definition of flip Since I called splint only on this file how does i...

sample rc file for splint

I am using splint for code checking, and it is throwing out a huge number of warnings. Some of them, I guess can be ignored. I am in the process of creating the .splintrc by trial and error. My question, Is there some sample .splintrc file that can be used? I am using splint for C code, written for a multi-tasking embedded system. ...

Is there a way to get Splint or a similar static checker to work with Linux Kernel modules?

I compiled ( no warnings ) the hello-5.c example from "The Linux Kernel Module Programming Guide" and when I tried to insmod it, I received the following error: insmod: error inserting 'hello-5.ko': -1 Unknown symbol in module I thought I would try splint to see if it came up with any obvious errors, but when I ran it I got a slew of ...

Removing null warnings in Splint

I have been trying out Splint with a C program I recently wrote and trying to understand and remove the warnings it gives. One I understand but can't understand how to remove it comes from the following code snippet: static MyType_t *findById(const int id) { int i; for (i = 0; i < MY_ARR_SIZE; i++) { if (my_arr[i].i...

splint whole program with a complex build process

I want to run splints whole program analysis on my system. However the system is quite large and different parts are compiled with different compiler defines and include paths. I can see how to convey this information to splint for a single file but I can't figure out how to do it for whole program. Does anyone know a way of doing this? ...

splint failing on code that includes complex.h

I'm trying to run splint on a C source that includes complex.h from the standard C library to support complex arithmetic. Unfortunately, splint fails with the following error. Splint 3.1.2 --- 03 May 2009 /usr/include/bits/cmathcalls.h:54:31: Parse Error: Non-function declaration: _Complex : extern double. (For help on...

Splint Code Analyzers for C

We are planning to use Splint as code analyzer for our C code base. But we never tried Splint tool before so we want your input on it's benifts, pros and cons. ...

How to resolve parse error in Splint

Splint is not continuing it's checking after finding parse errors. I've tried with +trytorecover option also but no change. Please let me know on how to use +trytorecover to make Splint attempt to continue after a parse error. Here is what I'm receiving, 161: splint +trytorecover spy.c Splint 3.1.1 --- 19 Jul 2006 spy.c:41:12: Parse ...

What is the meaning of this splint warning and what might I be doing wrong?

This is the line of code: bool cpfs_utimens(struct Cpfs *, char const *path, struct timespec const[2]); Running splint 3.1.2 generates this warning: cpfs.h:21:74: Function parameter times declared as manifest array (size constant is meaningless) A formal parameter is declared as an array with size. The size of the...

Splint barfs on __thread, which is part of C99

Running splint matt@stanley:~/cpfs$ splint -paramuse +gnuextensions cpfs.c Halts on this line: __thread int cpfs_errno; With a parse error: cpfs.c:127:13: Parse Error: Non-function declaration: __thread : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. Checking the documentatio...