[splint-discuss] splint-discuss Digest, Vol 59, Issue 5 Thank You
John Vogel
jvogel at mercuryinstruments.com
Wed Aug 19 13:22:29 PDT 2009
Thank you for the help. I defined a number of the values that splint
was giving me problems, following the examples that you gave me, the
program ran and gave me good results.
Sincerely,
John Vogel
Mercury Instruments a Honeywell Company.
-----Original Message-----
From: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of
splint-discuss-request at cs.virginia.edu
Sent: Wednesday, August 19, 2009 3:00 PM
To: splint-discuss at mail.cs.virginia.edu
Subject: splint-discuss Digest, Vol 59, Issue 5
Send splint-discuss mailing list submissions to
splint-discuss at mail.cs.virginia.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
or, via email, send a message with subject or body 'help' to
splint-discuss-request at mail.cs.virginia.edu
You can reach the person managing the list at
splint-discuss-owner at mail.cs.virginia.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of splint-discuss digest..."
Today's Topics:
1. Re: ??: parser error on ktime_t using splint on (Ludolf Holzheid)
2. R: Problem using splint (Roberto Bonacina)
3. Re: Problem using splint (Wenzel, Bodo)
4. Re: parser error on ktime_t using splint on (Wenzel, Bodo)
5. Re: splint-discuss Digest, Vol 59, Issue 4 (John Vogel)
----------------------------------------------------------------------
Message: 1
Date: Wed, 19 Aug 2009 10:26:26 +0200
From: Ludolf Holzheid <lholzheid at bihl-wiedemann.de>
Subject: Re: [splint-discuss] ??: parser error on ktime_t using splint
on
To: "'Discussions about the Splint annotation-assisted static analysis
project'" <splint-discuss at cs.virginia.edu>
Message-ID: <20090819082625.GC16188 at svr5.bihl-wiedemann.de>
Content-Type: text/plain; charset=iso-8859-1
On Wed, 2009-08-19 16:15:21 +0800, z00132473 wrote:
>
> [..]
>
> I modified the code to the following,and splint didn't report parser
error.
>
> [..]
>
> But in my code,there are lots of such use,so I cann't modify every
such code.
>
> Can you give me the suggestion on how to eliminate this error.
I'm afraid this just doesn't work, as splint is able to parse
ANSI-C89/ISO-C90 only.
Sorry.
Ludolf
--
---------------------------------------------------------------
Ludolf Holzheid Tel: +49 621 339960
Bihl+Wiedemann GmbH Fax: +49 621 3392239
Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------
------------------------------
Message: 2
Date: Wed, 19 Aug 2009 09:56:03 +0200
From: Roberto Bonacina <rbonacina at robur.it>
Subject: [splint-discuss] R: Problem using splint
To: "'Discussions about the Splint annotation-assisted static analysis
project'" <splint-discuss at cs.virginia.edu>
Message-ID: <000501ca20a2$7ff00e70$e601a8c0 at ARSENICO>
Content-Type: text/plain; charset=iso-8859-1
I think you need to conditionally define sfr (and sbit and eventually
other stuff).
You can do it in splint.rc or in a specific .h file.
----
First solution (splint.rc):
Add the following definitions in splint.rc file:
-Dsfr=volatile unsigned char
-Dsbit=volatile bool
----
Second solution (.h file):
Create a file (for example: splint.h) that contains:
#ifdef S_SPLINT_S
#define sfr volatile unsigned char
#define sbit volatile bool
#endif
Then, include this file in reg51.h.
----
Hope this helps.
Regards,
Roberto
-----Messaggio originale-----
Da: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] Per conto di John Vogel
Inviato: marted? 18 agosto 2009 22.07
A: splint-discuss at mail.cs.virginia.edu
Oggetto: [splint-discuss] Problem using splint
I am an embedded software developer. I have been trying to use SPLint
to check the applications to see if there are any memory links or other
errors. I get the following message:
Splint 3.1.1 --- 12 April 2003
Standard library: c:\splint-3.1.1\lib\standard.lcd
(created using Splint 3.018000)
< loading standard library c:\splint-3.1.1\lib\standard.lcd .... >
< preprocessing >
< checking c:\mer\4-20\fw\MI.C >
c:\keil\c51\inc\reg51.h(13,7): Parse Error: Non-function declaration:
sfr :
int. (For help on parse errors, see splint -help
parseerrors.)
*** Cannot continue.
Sfr is a command used my the compiler for registers in the Atmel chip
that we are using. How do I prevent these errors about Atmel registers
from occurring?
Sincerely,
John Vogel
Mercury Instruments, LLC
------------------------------
Message: 3
Date: Wed, 19 Aug 2009 11:39:40 +0200
From: "Wenzel, Bodo" <Wenzel at bbr-vt.de>
Subject: Re: [splint-discuss] Problem using splint
To: <splint-discuss at mail.cs.virginia.edu>
Message-ID: <46B6459B655D7342AB97371E8B7CD8B880FEF7 at sv-exch.BBR.local>
Content-Type: text/plain; charset="us-ascii"
> That is "#define sfr unsigned char" should do the trick.
In the (few) projects checked by Splint we cheat by mocking the
microcontroller specific stuff:
#ifdef S_SPLINT_S
#include "splint.h"
#else
#include <avr/pgmspace.h>
#endif
This is from a module for an AVR compiled by avr-gcc which uses memory
placement modifiers and special functions.
The file "splint.h" contains all the #define's and such to make the
source "splintable", for example:
/* We don't want to annotate each #define */
/*@-macroconstdecl@*/
/*@-macrofcndecl@*/
/*@-macroparams@*/
/* Constants starting with E are reserved */
/*@-isoreserved@*/
/* Stuff of pgmspace.h */
/*@notfunction@*/
#define PROGMEM /* empty */
/*@notfunction@*/
#define fputs_P fputs
/*@notfunction@*/
#define pgm_read_byte(address) (*(address))
/* EEPROM bits and registers */
#define E2END 0
#define EECR (*(unsigned char *)0)
#define EEMPE 0
#define EEPE 0
#define EERE 0
#define EEAR (*(unsigned short *)0)
#define EEDR (*(unsigned char *)0)
/*@=isoreserved@*/
/*@=macroparams@*/
/*@=macrofcndecl@*/
/*@=macroconstdecl@*/
Source code for 8051 controllers often contains modifiers like "code"
and "xdata"; these are comparable with "PROGMEM" of the example above.
Bodo
------------------------------
Message: 4
Date: Wed, 19 Aug 2009 11:48:06 +0200
From: "Wenzel, Bodo" <Wenzel at bbr-vt.de>
Subject: Re: [splint-discuss] parser error on ktime_t using splint on
To: <splint-discuss at mail.cs.virginia.edu>
Message-ID: <46B6459B655D7342AB97371E8B7CD8B880FEF8 at sv-exch.BBR.local>
Content-Type: text/plain; charset="us-ascii"
Ludolf,
You are perfectly right about C99.
> Yes it can. What you call 'initializer' may also be called 'constant'.
> And of course, constants may be used as expression.
Cool, that Splint knows this. Even cooler, if other compiler than GCC
knew this.
I remember that I had problems with an assigment of a correctly built
'constant' to a struct variable, thought assigning the contents of one
struct variable to another of the same type worked. The standard (C90)
is not very clear here. However, the compiler (Keil C51) is not that
perfect thing.
Bodo
------------------------------
Message: 5
Date: Wed, 19 Aug 2009 11:57:53 -0400
From: "John Vogel" <jvogel at mercuryinstruments.com>
Subject: Re: [splint-discuss] splint-discuss Digest, Vol 59, Issue 4
To: <splint-discuss at cs.virginia.edu>
Message-ID:
<FD65D8E129B1DF4680F7C9A38A2825A32C3FB5 at miexchange.mi.local>
Content-Type: text/plain; charset="us-ascii"
Here is an example of sfr usage:
sfr P0 = 0x80;
sfr P1 = 0x82;
-----Original Message-----
From: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of
splint-discuss-request at cs.virginia.edu
Sent: Wednesday, August 19, 2009 4:22 AM
To: splint-discuss at mail.cs.virginia.edu
Subject: splint-discuss Digest, Vol 59, Issue 4
Send splint-discuss mailing list submissions to
splint-discuss at mail.cs.virginia.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
or, via email, send a message with subject or body 'help' to
splint-discuss-request at mail.cs.virginia.edu
You can reach the person managing the list at
splint-discuss-owner at mail.cs.virginia.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of splint-discuss digest..."
Today's Topics:
1. Problem using splint (John Vogel)
2. Re: Problem using splint (Michael Wojcik)
3. Re: parser error on ktime_t using splint on (Wenzel, Bodo)
4. Re: parser error on ktime_t using splint on (Ludolf Holzheid)
5. Re: Problem using splint (Ludolf Holzheid)
6. ??: parser error on ktime_t using splint on (z00132473)
7. Re: Problem using splint (Ludolf Holzheid)
8. ??: parser error on ktime_t using splint on (z00132473)
----------------------------------------------------------------------
Message: 1
Date: Tue, 18 Aug 2009 16:06:39 -0400
From: "John Vogel" <jvogel at mercuryinstruments.com>
Subject: [splint-discuss] Problem using splint
To: <splint-discuss at mail.cs.virginia.edu>
Message-ID:
<FD65D8E129B1DF4680F7C9A38A2825A3291AF1 at miexchange.mi.local>
Content-Type: text/plain; charset="us-ascii"
I am an embedded software developer. I have been trying to use SPLint
to check the applications to see if there are any memory links or other
errors. I get the following message:
Splint 3.1.1 --- 12 April 2003
Standard library: c:\splint-3.1.1\lib\standard.lcd
(created using Splint 3.018000)
< loading standard library c:\splint-3.1.1\lib\standard.lcd .... >
< preprocessing >
< checking c:\mer\4-20\fw\MI.C >
c:\keil\c51\inc\reg51.h(13,7): Parse Error: Non-function declaration:
sfr :
int. (For help on parse errors, see splint -help
parseerrors.)
*** Cannot continue.
Sfr is a command used my the compiler for registers in the Atmel chip
that we are using. How do I prevent these errors about Atmel registers
from occurring?
Sincerely,
John Vogel
Mercury Instruments, LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090818
/28d69c99/attachment-0001.html
------------------------------
Message: 2
Date: Tue, 18 Aug 2009 14:39:57 -0700
From: "Michael Wojcik" <Michael.Wojcik at MicroFocus.com>
Subject: Re: [splint-discuss] Problem using splint
To: "Discussions about the Splint annotation-assisted static
analysisproject" <splint-discuss at cs.virginia.edu>
Message-ID:
<81F42F63D5BB344ABF294F8E80990C79084EBD at MTV-EXCHANGE.microfocus.com>
Content-Type: text/plain; charset="iso-8859-1"
> From: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of John Vogel
> Sent: Tuesday, 18 August, 2009 16:07
> I am an embedded software developer.? I have been trying to use SPLint
to check the
> applications to see if there are any memory links or other errors.? I
get the following
> message:
> c:\keil\c51\inc\reg51.h(13,7): Parse Error: Non-function declaration:
sfr :
>?????????????? int. (For help on parse errors, see splint -help
parseerrors.)
> Sfr is a command used my the compiler for registers in the Atmel chip
that we are
> using.? How do I prevent these errors about Atmel registers from
occurring?
My crystal ball is broken. What does the offending line of code actually
look like?
The most likely fix is to use an object-style macro to define away the
"sfr" token, and protect it with a compilation guard so it only takes
effect when running Splint. For example:
#if defined S_SPLINT_S
#undef sfr
#define sfr
#endif
--
Michael Wojcik
Principal Software Systems Developer, Micro Focus
------------------------------
Message: 3
Date: Wed, 19 Aug 2009 09:22:07 +0200
From: "Wenzel, Bodo" <Wenzel at bbr-vt.de>
Subject: Re: [splint-discuss] parser error on ktime_t using splint on
To: <splint-discuss at mail.cs.virginia.edu>
Message-ID: <46B6459B655D7342AB97371E8B7CD8B880FE76 at sv-exch.BBR.local>
Content-Type: text/plain; charset="us-ascii"
> return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
I see two issues here:
1) The initialisation of struct elements via their names is a GCC
extension to C. I don't think that Splint knows this extension.
2) I'm not sure that in ISO-C an initializer can be used as a 'normal'
expression, in this case for the return statement. This is probably also
a GCC extension unknown to Splint.
HTH, Bodo
------------------------------
Message: 4
Date: Wed, 19 Aug 2009 09:54:03 +0200
From: Ludolf Holzheid <lholzheid at bihl-wiedemann.de>
Subject: Re: [splint-discuss] parser error on ktime_t using splint on
To: splint-discuss at mail.cs.virginia.edu
Message-ID: <20090819075403.GA16188 at svr5.bihl-wiedemann.de>
Content-Type: text/plain; charset=iso-8859-1
On Wed, 2009-08-19 09:22:07 +0200, Wenzel, Bodo wrote:
> > return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
>
> I see two issues here:
>
> 1) The initialisation of struct elements via their names is a GCC
> extension to C. I don't think that Splint knows this extension.
The code snippet looks like valid C99 to me.
However, splint is able to check ANSI-C89/ISO-C90 only, so this
doesn't help Liping.
> 2) I'm not sure that in ISO-C an initializer can be used as a 'normal'
> expression, in this case for the return statement. This is probably
also
> a GCC extension unknown to Splint.
Yes it can. What you call 'initializer' may also be called 'constant'.
And of course, constants may be used as expression.
Ludolf
--
---------------------------------------------------------------
Ludolf Holzheid Tel: +49 621 339960
Bihl+Wiedemann GmbH Fax: +49 621 3392239
Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------
------------------------------
Message: 5
Date: Wed, 19 Aug 2009 10:09:16 +0200
From: Ludolf Holzheid <lholzheid at bihl-wiedemann.de>
Subject: Re: [splint-discuss] Problem using splint
To: splint-discuss at mail.cs.virginia.edu, Discussions about the
Splint
annotation-assisted static analysisproject
<splint-discuss at cs.virginia.edu>
Message-ID: <20090819080916.GB16188 at svr5.bihl-wiedemann.de>
Content-Type: text/plain; charset=iso-8859-1
On Tue, 2009-08-18 14:39:57 -0700, Michael Wojcik wrote:
> > From: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of John Vogel
> > Sent: Tuesday, 18 August, 2009 16:07
>
> > I am an embedded software developer.? I have been trying to use
SPLint to check the
> > applications to see if there are any memory links or other errors.?
I get the following
> > message:
>
> > c:\keil\c51\inc\reg51.h(13,7): Parse Error: Non-function
declaration: sfr :
> >?????????????? int. (For help on parse errors, see splint -help
parseerrors.)
>
> > Sfr is a command used my the compiler for registers in the Atmel
chip that we are
> > using.? How do I prevent these errors about Atmel registers from
occurring?
>
> My crystal ball is broken. What does the offending line of code
actually look like?
>
> The most likely fix is to use an object-style macro to define away the
"sfr" token, and protect it with a compilation guard so it only takes
effect when running Splint. For example:
>
> #if defined S_SPLINT_S
> #undef sfr
> #define sfr
> #endif
As far as I know the Keil C51 Compiler, the SFR declarations looks
like:
sfr P0 = 0x80;
That is "#define sfr unsigned char" should do the trick.
HTH,
Ludolf
--
---------------------------------------------------------------
Ludolf Holzheid Tel: +49 621 339960
Bihl+Wiedemann GmbH Fax: +49 621 3392239
Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------
------------------------------
Message: 6
Date: Wed, 19 Aug 2009 16:15:21 +0800
From: z00132473 <liping.zhang at huawei.com>
Subject: [splint-discuss] ??: parser error on ktime_t using splint on
To: "'Discussions about the Splint annotation-assisted static analysis
project'" <splint-discuss at cs.virginia.edu>,
splint-discuss at mail.cs.virginia.edu
Message-ID: <000c01ca20a5$3219e150$d638a10a at china.huawei.com>
Content-Type: text/plain; charset=utf-8
Hi,Bodo and Ludolf
Thanks for your response,
I think your answer are helpful to me.
I modified the code to the following,and splint didn't report parser
error.
{
Ktime_t time;
time.tv.sec = secs;
time.tv.nsec = nsecs;
Return time;
}
But in my code,there are lots of such use,so I cann't modify every such
code.
Can you give me the suggestion on how to eliminate this error.
Thanks& best regards!
liping
-----????-----
???: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] ?? Ludolf Holzheid
????: 2009?8?19? 15:54
???: splint-discuss at mail.cs.virginia.edu
??: Re: [splint-discuss] parser error on ktime_t using splint on
On Wed, 2009-08-19 09:22:07 +0200, Wenzel, Bodo wrote:
> > return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
>
> I see two issues here:
>
> 1) The initialisation of struct elements via their names is a GCC
> extension to C. I don't think that Splint knows this extension.
The code snippet looks like valid C99 to me.
However, splint is able to check ANSI-C89/ISO-C90 only, so this
doesn't help Liping.
> 2) I'm not sure that in ISO-C an initializer can be used as a 'normal'
> expression, in this case for the return statement. This is probably
also
> a GCC extension unknown to Splint.
Yes it can. What you call 'initializer' may also be called 'constant'.
And of course, constants may be used as expression.
Ludolf
--
---------------------------------------------------------------
Ludolf Holzheid Tel: +49 621 339960
Bihl+Wiedemann GmbH Fax: +49 621 3392239
Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------
_______________________________________________
splint-discuss mailing list
splint-discuss at mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
------------------------------
Message: 7
Date: Wed, 19 Aug 2009 10:09:16 +0200
From: Ludolf Holzheid <lholzheid at bihl-wiedemann.de>
Subject: Re: [splint-discuss] Problem using splint
To: splint-discuss at mail.cs.virginia.edu, Discussions about the
Splint
annotation-assisted static analysisproject
<splint-discuss at cs.virginia.edu>
Message-ID: <20090819080916.GB16188 at svr5.bihl-wiedemann.de>
Content-Type: text/plain; charset=iso-8859-1
On Tue, 2009-08-18 14:39:57 -0700, Michael Wojcik wrote:
> > From: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of John Vogel
> > Sent: Tuesday, 18 August, 2009 16:07
>
> > I am an embedded software developer.? I have been trying to use
SPLint to check the
> > applications to see if there are any memory links or other errors.?
I get the following
> > message:
>
> > c:\keil\c51\inc\reg51.h(13,7): Parse Error: Non-function
declaration: sfr :
> >?????????????? int. (For help on parse errors, see splint -help
parseerrors.)
>
> > Sfr is a command used my the compiler for registers in the Atmel
chip that we are
> > using.? How do I prevent these errors about Atmel registers from
occurring?
>
> My crystal ball is broken. What does the offending line of code
actually look like?
>
> The most likely fix is to use an object-style macro to define away the
"sfr" token, and protect it with a compilation guard so it only takes
effect when running Splint. For example:
>
> #if defined S_SPLINT_S
> #undef sfr
> #define sfr
> #endif
As far as I know the Keil C51 Compiler, the SFR declarations looks
like:
sfr P0 = 0x80;
That is "#define sfr unsigned char" should do the trick.
HTH,
Ludolf
--
---------------------------------------------------------------
Ludolf Holzheid Tel: +49 621 339960
Bihl+Wiedemann GmbH Fax: +49 621 3392239
Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------
------------------------------
Message: 8
Date: Wed, 19 Aug 2009 16:15:21 +0800
From: z00132473 <liping.zhang at huawei.com>
Subject: [splint-discuss] ??: parser error on ktime_t using splint on
To: "'Discussions about the Splint annotation-assisted static analysis
project'" <splint-discuss at cs.virginia.edu>,
splint-discuss at mail.cs.virginia.edu
Message-ID: <000c01ca20a5$3219e150$d638a10a at china.huawei.com>
Content-Type: text/plain; charset=utf-8
Hi,Bodo and Ludolf
Thanks for your response,
I think your answer are helpful to me.
I modified the code to the following,and splint didn't report parser
error.
{
Ktime_t time;
time.tv.sec = secs;
time.tv.nsec = nsecs;
Return time;
}
But in my code,there are lots of such use,so I cann't modify every such
code.
Can you give me the suggestion on how to eliminate this error.
Thanks& best regards!
liping
-----????-----
???: splint-discuss-bounces at cs.virginia.edu
[mailto:splint-discuss-bounces at cs.virginia.edu] ?? Ludolf Holzheid
????: 2009?8?19? 15:54
???: splint-discuss at mail.cs.virginia.edu
??: Re: [splint-discuss] parser error on ktime_t using splint on
On Wed, 2009-08-19 09:22:07 +0200, Wenzel, Bodo wrote:
> > return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
>
> I see two issues here:
>
> 1) The initialisation of struct elements via their names is a GCC
> extension to C. I don't think that Splint knows this extension.
The code snippet looks like valid C99 to me.
However, splint is able to check ANSI-C89/ISO-C90 only, so this
doesn't help Liping.
> 2) I'm not sure that in ISO-C an initializer can be used as a 'normal'
> expression, in this case for the return statement. This is probably
also
> a GCC extension unknown to Splint.
Yes it can. What you call 'initializer' may also be called 'constant'.
And of course, constants may be used as expression.
Ludolf
--
---------------------------------------------------------------
Ludolf Holzheid Tel: +49 621 339960
Bihl+Wiedemann GmbH Fax: +49 621 3392239
Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------
_______________________________________________
splint-discuss mailing list
splint-discuss at mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
------------------------------
_______________________________________________
splint-discuss mailing list
splint-discuss at mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
End of splint-discuss Digest, Vol 59, Issue 4
*********************************************
------------------------------
_______________________________________________
splint-discuss mailing list
splint-discuss at mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
End of splint-discuss Digest, Vol 59, Issue 5
*********************************************
More information about the splint-discuss
mailing list