-
Casting seems to change the tracking of /*@out@*/ parameters.
The following code gives gives the warning below, but without the cast to char* , there is no warning, despite the cast being completely valid.
Code:
int func2( /*@out@*/ char *bytes );
void func1(/*@out@*/ void *buf)
{
(void) func2( (char*)buf );
}
Output:
Splint 3.1.2 --- 15 Feb 2009...
2009-02-15 23:30:10 UTC by nobody
-
See attachement for this compile error fix.
$ uname -a
SunOS 5.9 Generic_122300-35 sun4u sparc
$ make
...
osd.c: In function `osd_getPid':
osd.c:519: error: `__pid_t' undeclared (first use in this function)
osd.c:519: error: (Each undeclared identifier is reported only once
osd.c:519: error: for each function it appears in.)
osd.c:519: error: syntax error before "pid"
osd.c:522...
2009-01-29 15:06:54 UTC by jaalto
-
splint +booltype bool_t +boolfalse FALSE +booltrue TRUE -boolops -branchstate +charint +charintliteral -compdef -compmempass +continue-comment -dependenttrans -duplicatequals -exportlocal +topuse +formalarray +forblock -globstate +ifblock +ignoresigns -immediatetrans -kepttrans +macroempty -macrovarprefix "_%*" -macrovarprefix-exclude +match-any-integral -mayaliasunique -mustfree +noparams +null...
2008-06-30 19:15:33 UTC by nobody
-
/usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428:
Unexpanded macro not function or constant: int _PC_MAX_CANON [errno: 25]
*** Please report bug to splint-bug@splint.org ***
(attempting to continue, results may be incorrect)
/usr/include/bits/confname.h:32:1: Parse Error: Non-function declaration:
_PC_MAX_CANON : int. (For help on parse errors...
2008-06-30 19:14:31 UTC by nobody
-
This block of code comment:
//**************************************************************
//* blah blah blah *
//**************************************************************
produces this message from splint-3.1.1
aCodeFile.c(447,67): Comment starts inside comment
aCodeFile.c(448,67): Comment starts inside comment
aCodeFile.c(449,67): Comment starts inside comment.
2008-05-05 21:44:52 UTC by dbeuning
-
Splint warns when the first statement after a switch is not a case. However, this warning can be blocked by a statement label. In the below fragment we have a warning for the first switch, but not for the second one.
void f( void )
{
int i = 1, c;
switch (i)
{
c = 0;
}
switch (i)
{
lab: c = 2;
}
}
Splint 3.1.1.2 --- 27 May 2007
redef.c: (in...
2007-07-10 18:22:24 UTC by nobody
-
if (i == 3)
if (c == 3)
{
x = 4;
}
else
c = 5;
When +if-block is on, splint 3.1.1.2 gives, correctly, warning about the missing braces around c = 5, but it should also warn that braces are missing around the if statement on the if branch.
The warning-free version of the above piece is this:
if (i == 3)
{
if (c == 3)
{
x = 4;
}
}
else
{
c...
2007-07-09 19:58:53 UTC by nobody
-
Well, the reason might have been that the problems switch and do/while can present are more benign than those three. For example, multiple statements without enclosing braces between do and while are simply a syntactical error. splint awards them with a "parse error".
switch is a bit nastier:
switch( i )
case 1:
x = 1;
c = 3;
if (c == 3)
2007-07-09 19:35:31 UTC by nobody
-
splint can be made to check that the statements controlled by if, for and while are block statements (flag if-block and the like).
Although switch and do ... while can cause very similar problems as the above three, splint does not check them. Judging by the manual, these two were omitted by design for some reason.
br
pkzc at freemail dot hu.
2007-07-07 20:08:57 UTC by nobody
-
Source code :
char firstchar1(char *s)
{
return *s;
}
char firstchar2(char *s)
{
if(s==NULL)
return *s;
else
return '0';
}
while running splint as
./splint +null func.c or
./splint func.c
both time output of splint is same and output is:
Splint 3.1.1 --- 28 Apr 2003
Finished checking --- no warnings...
2007-07-04 12:49:23 UTC by nobody