From tom.parkin at gmail.com Tue Aug 11 07:51:56 2009 From: tom.parkin at gmail.com (Tom Parkin) Date: Tue, 11 Aug 2009 15:51:56 +0100 Subject: [splint-discuss] Suppressing errors from files on a certain path Message-ID: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> Hi splint-discuss, I'm using splint to check some Windows driver code I am developing. I have this working, but splint reports many warnings for various headers in the Windows DDK tree. Since I cannot make changes in the DDK tree, I'd like to be able to suppress these warnings so I can more easily concentrate on reports directly associated with my code. Is it possible to ask splint to suppress warnings on a file path basis, e.g. so I can exclude c:\winddk\inc\* ? Thanks in advance for any suggestions, and my apologies if I'm asking an FAQ. I have checked the splint manual and "splint -help" output (as well as searching the archives!), but to no avail so far. Best regards, Tom -- Tom Parkin www.thhp.org.uk The worst moment for the atheist is when he is really thankful and has nobody to thank /Rossetti/ From vijayendra.suman at gmail.com Tue Aug 11 09:21:07 2009 From: vijayendra.suman at gmail.com (Vijayendra Suman) Date: Tue, 11 Aug 2009 21:51:07 +0530 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> Message-ID: <581ef6d60908110921t256a9018p71ad1433ca1bac73@mail.gmail.com> Hello Tom, To avoid parsing the headers there are various scenarios - +never-include is set, inclusion of files ending in .h is prevented Adding +I will prevent checking these files, reference Splint manual Page 72 You can also check the section 14.3 *Header Inclusion: Page Number 98* Regards V.Suman On Tue, Aug 11, 2009 at 8:21 PM, Tom Parkin wrote: > Hi splint-discuss, > > I'm using splint to check some Windows driver code I am developing. I > have this working, but splint reports many warnings for various > headers in the Windows DDK tree. Since I cannot make changes in the > DDK tree, I'd like to be able to suppress these warnings so I can more > easily concentrate on reports directly associated with my code. > > Is it possible to ask splint to suppress warnings on a file path > basis, e.g. so I can exclude c:\winddk\inc\* ? > > Thanks in advance for any suggestions, and my apologies if I'm asking > an FAQ. I have checked the splint manual and "splint -help" output > (as well as searching the archives!), but to no avail so far. > > Best regards, > Tom > -- > Tom Parkin > www.thhp.org.uk > The worst moment for the atheist is when he is really thankful and has > nobody to thank /Rossetti/ > _______________________________________________ > splint-discuss mailing list > splint-discuss at mail.cs.virginia.edu > http://www.cs.virginia.edu/mailman/listinfo/splint-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090811/e11fa472/attachment.html From vijayendra.suman at gmail.com Tue Aug 11 09:21:07 2009 From: vijayendra.suman at gmail.com (Vijayendra Suman) Date: Tue, 11 Aug 2009 21:51:07 +0530 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> Message-ID: <581ef6d60908110921t256a9018p71ad1433ca1bac73@mail.gmail.com> Hello Tom, To avoid parsing the headers there are various scenarios - +never-include is set, inclusion of files ending in .h is prevented Adding +I will prevent checking these files, reference Splint manual Page 72 You can also check the section 14.3 *Header Inclusion: Page Number 98* Regards V.Suman On Tue, Aug 11, 2009 at 8:21 PM, Tom Parkin wrote: > Hi splint-discuss, > > I'm using splint to check some Windows driver code I am developing. I > have this working, but splint reports many warnings for various > headers in the Windows DDK tree. Since I cannot make changes in the > DDK tree, I'd like to be able to suppress these warnings so I can more > easily concentrate on reports directly associated with my code. > > Is it possible to ask splint to suppress warnings on a file path > basis, e.g. so I can exclude c:\winddk\inc\* ? > > Thanks in advance for any suggestions, and my apologies if I'm asking > an FAQ. I have checked the splint manual and "splint -help" output > (as well as searching the archives!), but to no avail so far. > > Best regards, > Tom > -- > Tom Parkin > www.thhp.org.uk > The worst moment for the atheist is when he is really thankful and has > nobody to thank /Rossetti/ > _______________________________________________ > splint-discuss mailing list > splint-discuss at mail.cs.virginia.edu > http://www.cs.virginia.edu/mailman/listinfo/splint-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090811/e11fa472/attachment-0001.html From lholzheid at bihl-wiedemann.de Tue Aug 11 09:59:08 2009 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Tue, 11 Aug 2009 18:59:08 +0200 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> Message-ID: <20090811165908.GC6047@svr5.bihl-wiedemann.de> On Tue, 2009-08-11 15:51:56 +0100, Tom Parkin wrote: > Hi splint-discuss, > > I'm using splint to check some Windows driver code I am developing. I > have this working, but splint reports many warnings for various > headers in the Windows DDK tree. Since I cannot make changes in the > DDK tree, I'd like to be able to suppress these warnings so I can more > easily concentrate on reports directly associated with my code. > > Is it possible to ask splint to suppress warnings on a file path > basis, e.g. so I can exclude c:\winddk\inc\* ? I'd give '-sysdirs C:/winddk -sysdirerrors' a try. 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 --------------------------------------------------------------- From lholzheid at bihl-wiedemann.de Tue Aug 11 09:59:08 2009 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Tue, 11 Aug 2009 18:59:08 +0200 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> Message-ID: <20090811165908.GC6047@svr5.bihl-wiedemann.de> On Tue, 2009-08-11 15:51:56 +0100, Tom Parkin wrote: > Hi splint-discuss, > > I'm using splint to check some Windows driver code I am developing. I > have this working, but splint reports many warnings for various > headers in the Windows DDK tree. Since I cannot make changes in the > DDK tree, I'd like to be able to suppress these warnings so I can more > easily concentrate on reports directly associated with my code. > > Is it possible to ask splint to suppress warnings on a file path > basis, e.g. so I can exclude c:\winddk\inc\* ? I'd give '-sysdirs C:/winddk -sysdirerrors' a try. 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 --------------------------------------------------------------- From tom.parkin at gmail.com Tue Aug 11 14:18:09 2009 From: tom.parkin at gmail.com (Tom Parkin) Date: Tue, 11 Aug 2009 22:18:09 +0100 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <581ef6d60908110921t256a9018p71ad1433ca1bac73@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> <581ef6d60908110921t256a9018p71ad1433ca1bac73@mail.gmail.com> Message-ID: <2facd6dc0908111418xa371427u19d8af9eff4683b8@mail.gmail.com> Hi Vijayendra, 2009/8/11 Vijayendra Suman : > +never-include is set, inclusion of files ending in .h is prevented > > Adding +I will prevent checking these files, > reference Splint manual Page 72 Thank you for the suggestions, I'll give them a try! I wonder whether "+never-include" may not a step too far, if I understand what it does correctly -- I'd still like to have the headers included for the various definitions in them, but I want to suppress the warnings. However, +I looks like it might do the trick with judicious choice of include directory. Thanks again for your help. Best regards, Tom From tom.parkin at gmail.com Tue Aug 11 14:19:45 2009 From: tom.parkin at gmail.com (Tom Parkin) Date: Tue, 11 Aug 2009 22:19:45 +0100 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <20090811165908.GC6047@svr5.bihl-wiedemann.de> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> <20090811165908.GC6047@svr5.bihl-wiedemann.de> Message-ID: <2facd6dc0908111419y487f8027lc0217ed238657a15@mail.gmail.com> 2009/8/11 Ludolf Holzheid : > I'd give '-sysdirs C:/winddk -sysdirerrors' a try. Thanks, Ludolf, that looks like a good combination. I'll try it out when I'm back in the office tomorrow. Best regards, Tom From tom.parkin at gmail.com Tue Aug 11 14:19:45 2009 From: tom.parkin at gmail.com (Tom Parkin) Date: Tue, 11 Aug 2009 22:19:45 +0100 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <20090811165908.GC6047@svr5.bihl-wiedemann.de> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> <20090811165908.GC6047@svr5.bihl-wiedemann.de> Message-ID: <2facd6dc0908111419y487f8027lc0217ed238657a15@mail.gmail.com> 2009/8/11 Ludolf Holzheid : > I'd give '-sysdirs C:/winddk -sysdirerrors' a try. Thanks, Ludolf, that looks like a good combination. I'll try it out when I'm back in the office tomorrow. Best regards, Tom From tom.parkin at gmail.com Tue Aug 11 14:18:09 2009 From: tom.parkin at gmail.com (Tom Parkin) Date: Tue, 11 Aug 2009 22:18:09 +0100 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <581ef6d60908110921t256a9018p71ad1433ca1bac73@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> <581ef6d60908110921t256a9018p71ad1433ca1bac73@mail.gmail.com> Message-ID: <2facd6dc0908111418xa371427u19d8af9eff4683b8@mail.gmail.com> Hi Vijayendra, 2009/8/11 Vijayendra Suman : > +never-include is set, inclusion of files ending in .h is prevented > > Adding +I will prevent checking these files, > reference Splint manual Page 72 Thank you for the suggestions, I'll give them a try! I wonder whether "+never-include" may not a step too far, if I understand what it does correctly -- I'd still like to have the headers included for the various definitions in them, but I want to suppress the warnings. However, +I looks like it might do the trick with judicious choice of include directory. Thanks again for your help. Best regards, Tom From tom.parkin at gmail.com Wed Aug 12 00:52:11 2009 From: tom.parkin at gmail.com (Tom Parkin) Date: Wed, 12 Aug 2009 08:52:11 +0100 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <2facd6dc0908111419y487f8027lc0217ed238657a15@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> <20090811165908.GC6047@svr5.bihl-wiedemann.de> <2facd6dc0908111419y487f8027lc0217ed238657a15@mail.gmail.com> Message-ID: <2facd6dc0908120052k5033bb79la3a533b72ab714a6@mail.gmail.com> 2009/8/11 Tom Parkin : > 2009/8/11 Ludolf Holzheid : >> I'd give '-sysdirs C:/winddk -sysdirerrors' a try. > >?I'll try it out when I'm back in the office tomorrow. I've had a chance to try the above, and found only the "-sysdirs" flag to be necessary -- "-sysdirerrors" in this context generated a warning: "Setting -sysdirerrors redundant with current value". With "-sysdirs c:\winddk" I now get warnings about my code alone, which is exactly what I wanted. Thanks again, Ludolf ! Tom -- Tom Parkin www.thhp.org.uk The worst moment for the atheist is when he is really thankful and has nobody to thank /Rossetti/ From tom.parkin at gmail.com Wed Aug 12 00:52:11 2009 From: tom.parkin at gmail.com (Tom Parkin) Date: Wed, 12 Aug 2009 08:52:11 +0100 Subject: [splint-discuss] Suppressing errors from files on a certain path In-Reply-To: <2facd6dc0908111419y487f8027lc0217ed238657a15@mail.gmail.com> References: <2facd6dc0908110751g6146b1e2mbd136fc3505bc693@mail.gmail.com> <20090811165908.GC6047@svr5.bihl-wiedemann.de> <2facd6dc0908111419y487f8027lc0217ed238657a15@mail.gmail.com> Message-ID: <2facd6dc0908120052k5033bb79la3a533b72ab714a6@mail.gmail.com> 2009/8/11 Tom Parkin : > 2009/8/11 Ludolf Holzheid : >> I'd give '-sysdirs C:/winddk -sysdirerrors' a try. > >?I'll try it out when I'm back in the office tomorrow. I've had a chance to try the above, and found only the "-sysdirs" flag to be necessary -- "-sysdirerrors" in this context generated a warning: "Setting -sysdirerrors redundant with current value". With "-sysdirs c:\winddk" I now get warnings about my code alone, which is exactly what I wanted. Thanks again, Ludolf ! Tom -- Tom Parkin www.thhp.org.uk The worst moment for the atheist is when he is really thankful and has nobody to thank /Rossetti/ From liping.zhang at huawei.com Tue Aug 18 00:19:08 2009 From: liping.zhang at huawei.com (z00132473) Date: Tue, 18 Aug 2009 15:19:08 +0800 Subject: [splint-discuss] parser error on ktime_t using splint on linux kernel of ARM project! Message-ID: <000b01ca1fd4$2d5b33c0$d638a10a@china.huawei.com> _____ Hi, I'm trying to use splint in linux kernel whose version is 2.6.27 .Now I met the followding parse error: ../../../../../lint/lintinclude/linux/ktime.h:154:22: Parse Error.(For help on parse errors,see splint -help parseerrors.) ***Cannot continue. The line 154 of ktime.h is as followding. return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } }; I ever met similar errors,and it seemed that the callback is not recognized by splint. I used "ifndef S_SPLINT_S" to mark this code,then the error would disappear,but I wonder if there are other ways to resolve the error. Can anyone suggest me solution for the question? Thanks! Liping Email:liping.zhang at huawei.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090818/79d89ea0/attachment.html From jvogel at mercuryinstruments.com Tue Aug 18 13:06:39 2009 From: jvogel at mercuryinstruments.com (John Vogel) Date: Tue, 18 Aug 2009 16:06:39 -0400 Subject: [splint-discuss] Problem using splint Message-ID: 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.html From Michael.Wojcik at MicroFocus.com Tue Aug 18 14:39:57 2009 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Tue, 18 Aug 2009 14:39:57 -0700 Subject: [splint-discuss] Problem using splint In-Reply-To: References: Message-ID: <81F42F63D5BB344ABF294F8E80990C79084EBD@MTV-EXCHANGE.microfocus.com> > 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 From Wenzel at bbr-vt.de Wed Aug 19 00:22:07 2009 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Wed, 19 Aug 2009 09:22:07 +0200 Subject: [splint-discuss] parser error on ktime_t using splint on Message-ID: <46B6459B655D7342AB97371E8B7CD8B880FE76@sv-exch.BBR.local> > 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 From lholzheid at bihl-wiedemann.de Wed Aug 19 00:54:03 2009 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed, 19 Aug 2009 09:54:03 +0200 Subject: [splint-discuss] parser error on ktime_t using splint on In-Reply-To: <46B6459B655D7342AB97371E8B7CD8B880FE76@sv-exch.BBR.local> References: <46B6459B655D7342AB97371E8B7CD8B880FE76@sv-exch.BBR.local> Message-ID: <20090819075403.GA16188@svr5.bihl-wiedemann.de> 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 --------------------------------------------------------------- From lholzheid at bihl-wiedemann.de Wed Aug 19 01:09:16 2009 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed, 19 Aug 2009 10:09:16 +0200 Subject: [splint-discuss] Problem using splint In-Reply-To: <81F42F63D5BB344ABF294F8E80990C79084EBD@MTV-EXCHANGE.microfocus.com> References: <81F42F63D5BB344ABF294F8E80990C79084EBD@MTV-EXCHANGE.microfocus.com> Message-ID: <20090819080916.GB16188@svr5.bihl-wiedemann.de> 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 --------------------------------------------------------------- From liping.zhang at huawei.com Wed Aug 19 01:15:21 2009 From: liping.zhang at huawei.com (z00132473) Date: Wed, 19 Aug 2009 16:15:21 +0800 Subject: [splint-discuss] =?utf-8?b?562U5aSNOiAgcGFyc2VyIGVycm9yIG9uIGt0?= =?utf-8?q?ime=5Ft_using_splint_on?= In-Reply-To: <20090819075403.GA16188@svr5.bihl-wiedemann.de> Message-ID: <000c01ca20a5$3219e150$d638a10a@china.huawei.com> 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 From lholzheid at bihl-wiedemann.de Wed Aug 19 01:09:16 2009 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed, 19 Aug 2009 10:09:16 +0200 Subject: [splint-discuss] Problem using splint In-Reply-To: <81F42F63D5BB344ABF294F8E80990C79084EBD@MTV-EXCHANGE.microfocus.com> References: <81F42F63D5BB344ABF294F8E80990C79084EBD@MTV-EXCHANGE.microfocus.com> Message-ID: <20090819080916.GB16188@svr5.bihl-wiedemann.de> 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 --------------------------------------------------------------- From liping.zhang at huawei.com Wed Aug 19 01:15:21 2009 From: liping.zhang at huawei.com (z00132473) Date: Wed, 19 Aug 2009 16:15:21 +0800 Subject: [splint-discuss] =?utf-8?b?562U5aSNOiAgcGFyc2VyIGVycm9yIG9uIGt0?= =?utf-8?q?ime=5Ft_using_splint_on?= In-Reply-To: <20090819075403.GA16188@svr5.bihl-wiedemann.de> Message-ID: <000c01ca20a5$3219e150$d638a10a@china.huawei.com> 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 From lholzheid at bihl-wiedemann.de Wed Aug 19 01:26:26 2009 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed, 19 Aug 2009 10:26:26 +0200 Subject: [splint-discuss] =?utf-8?b?562U5aSNOiBwYXJzZXIgZXJyb3Igb24ga3Rp?= =?utf-8?q?me=5Ft_using_splint_on?= In-Reply-To: <000c01ca20a5$3219e150$d638a10a@china.huawei.com> References: <20090819075403.GA16188@svr5.bihl-wiedemann.de> <000c01ca20a5$3219e150$d638a10a@china.huawei.com> Message-ID: <20090819082625.GC16188@svr5.bihl-wiedemann.de> 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 --------------------------------------------------------------- From rbonacina at robur.it Wed Aug 19 00:56:03 2009 From: rbonacina at robur.it (Roberto Bonacina) Date: Wed, 19 Aug 2009 09:56:03 +0200 Subject: [splint-discuss] R: Problem using splint In-Reply-To: Message-ID: <000501ca20a2$7ff00e70$e601a8c0@ARSENICO> 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 From Wenzel at bbr-vt.de Wed Aug 19 02:39:40 2009 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Wed, 19 Aug 2009 11:39:40 +0200 Subject: [splint-discuss] Problem using splint Message-ID: <46B6459B655D7342AB97371E8B7CD8B880FEF7@sv-exch.BBR.local> > 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 #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 From Wenzel at bbr-vt.de Wed Aug 19 02:48:06 2009 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Wed, 19 Aug 2009 11:48:06 +0200 Subject: [splint-discuss] parser error on ktime_t using splint on Message-ID: <46B6459B655D7342AB97371E8B7CD8B880FEF8@sv-exch.BBR.local> 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 From jvogel at mercuryinstruments.com Wed Aug 19 08:57:53 2009 From: jvogel at mercuryinstruments.com (John Vogel) Date: Wed, 19 Aug 2009 11:57:53 -0400 Subject: [splint-discuss] splint-discuss Digest, Vol 59, Issue 4 In-Reply-To: References: Message-ID: 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" Subject: [splint-discuss] Problem using splint To: Message-ID: 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" Subject: Re: [splint-discuss] Problem using splint To: "Discussions about the Splint annotation-assisted static analysisproject" 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" Subject: Re: [splint-discuss] parser error on ktime_t using splint on To: 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 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 Subject: Re: [splint-discuss] Problem using splint To: splint-discuss at mail.cs.virginia.edu, Discussions about the Splint annotation-assisted static analysisproject 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 Subject: [splint-discuss] ??: parser error on ktime_t using splint on To: "'Discussions about the Splint annotation-assisted static analysis project'" , 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 Subject: Re: [splint-discuss] Problem using splint To: splint-discuss at mail.cs.virginia.edu, Discussions about the Splint annotation-assisted static analysisproject 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 Subject: [splint-discuss] ??: parser error on ktime_t using splint on To: "'Discussions about the Splint annotation-assisted static analysis project'" , 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 ********************************************* From jvogel at mercuryinstruments.com Wed Aug 19 13:22:29 2009 From: jvogel at mercuryinstruments.com (John Vogel) Date: Wed, 19 Aug 2009 16:22:29 -0400 Subject: [splint-discuss] splint-discuss Digest, Vol 59, Issue 5 Thank You In-Reply-To: References: Message-ID: 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 Subject: Re: [splint-discuss] ??: parser error on ktime_t using splint on To: "'Discussions about the Splint annotation-assisted static analysis project'" 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 Subject: [splint-discuss] R: Problem using splint To: "'Discussions about the Splint annotation-assisted static analysis project'" 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" Subject: Re: [splint-discuss] Problem using splint To: 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 #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" Subject: Re: [splint-discuss] parser error on ktime_t using splint on To: 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" Subject: Re: [splint-discuss] splint-discuss Digest, Vol 59, Issue 4 To: Message-ID: 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" Subject: [splint-discuss] Problem using splint To: Message-ID: 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" Subject: Re: [splint-discuss] Problem using splint To: "Discussions about the Splint annotation-assisted static analysisproject" 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" Subject: Re: [splint-discuss] parser error on ktime_t using splint on To: 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 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 Subject: Re: [splint-discuss] Problem using splint To: splint-discuss at mail.cs.virginia.edu, Discussions about the Splint annotation-assisted static analysisproject 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 Subject: [splint-discuss] ??: parser error on ktime_t using splint on To: "'Discussions about the Splint annotation-assisted static analysis project'" , 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 Subject: Re: [splint-discuss] Problem using splint To: splint-discuss at mail.cs.virginia.edu, Discussions about the Splint annotation-assisted static analysisproject 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 Subject: [splint-discuss] ??: parser error on ktime_t using splint on To: "'Discussions about the Splint annotation-assisted static analysis project'" , 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 ********************************************* From liping.zhang at huawei.com Wed Aug 19 23:39:46 2009 From: liping.zhang at huawei.com (z00132473) Date: Thu, 20 Aug 2009 14:39:46 +0800 Subject: [splint-discuss] =?gb2312?b?tPC4tDogIHBhcnNlciBlcnJvciBvbiBrdGlt?= =?gb2312?b?ZV90IHVzaW5nIHNwbGludCBvbg==?= In-Reply-To: <46B6459B655D7342AB97371E8B7CD8B880FEF8@sv-exch.BBR.local> Message-ID: <000001ca2161$02755a30$d638a10a@china.huawei.com> Thanks. I have met other parser errors.I think it happen because splint doesn't know GCC keywords. 1) ../../../../lint/lintinclude/linux/input.h:1263:170 Parser Error.(For help on parse errors,see splint -help parserrors.) ***Cannot continue. The code of line 263 of input.h is"return dev ? to_input_dev(get_device(&dev->dev)) : NULL;",and ?to_input_dev? is defined as?#define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );})? It's apparent that splint doesn't know above definition.Why and how to resovle? 2) mpp.c:100:113 Parser Error.(For help on parse errors,see splint -help parserrors.) ***Cannot continue. The code is below. /*******************************************/ For(n=0;n 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 _______________________________________________ splint-discuss mailing list splint-discuss at mail.cs.virginia.edu http://www.cs.virginia.edu/mailman/listinfo/splint-discuss From liping.zhang at huawei.com Wed Aug 19 23:39:46 2009 From: liping.zhang at huawei.com (z00132473) Date: Thu, 20 Aug 2009 14:39:46 +0800 Subject: [splint-discuss] =?gb2312?b?tPC4tDogIHBhcnNlciBlcnJvciBvbiBrdGlt?= =?gb2312?b?ZV90IHVzaW5nIHNwbGludCBvbg==?= In-Reply-To: <46B6459B655D7342AB97371E8B7CD8B880FEF8@sv-exch.BBR.local> Message-ID: <000001ca2161$02755a30$d638a10a@china.huawei.com> Thanks. I have met other parser errors.I think it happen because splint doesn't know GCC keywords. 1) ../../../../lint/lintinclude/linux/input.h:1263:170 Parser Error.(For help on parse errors,see splint -help parserrors.) ***Cannot continue. The code of line 263 of input.h is"return dev ? to_input_dev(get_device(&dev->dev)) : NULL;",and ?to_input_dev? is defined as?#define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );})? It's apparent that splint doesn't know above definition.Why and how to resovle? 2) mpp.c:100:113 Parser Error.(For help on parse errors,see splint -help parserrors.) ***Cannot continue. The code is below. /*******************************************/ For(n=0;n 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 _______________________________________________ splint-discuss mailing list splint-discuss at mail.cs.virginia.edu http://www.cs.virginia.edu/mailman/listinfo/splint-discuss From Wenzel at bbr-vt.de Wed Aug 19 23:54:10 2009 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Thu, 20 Aug 2009 08:54:10 +0200 Subject: [splint-discuss] parser error on ktime_t using splint on Message-ID: <46B6459B655D7342AB97371E8B7CD8B880FFD6@sv-exch.BBR.local> Liping, Presumably it is a bad idea to check Linux kernel sources (heavily based on C99/GCC features) with Splint (C90). I won't even try this. ;-) It seems that you like to check your sources that include kernel headers. You might like to ignore those system headers (RTM!) and/or to cheat Splint like suggested in the thread "Problem using splint." Bodo From lholzheid at bihl-wiedemann.de Thu Aug 20 00:12:30 2009 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Thu, 20 Aug 2009 09:12:30 +0200 Subject: [splint-discuss] splint-discuss Digest, Vol 59, Issue 4 In-Reply-To: References: Message-ID: <20090820071230.GA21217@svr5.bihl-wiedemann.de> On Wed, 2009-08-19 11:57:53 -0400, John Vogel wrote: > Here is an example of sfr usage: > sfr P0 = 0x80; > sfr P1 = 0x82; > > -----Original Message----- > [ 15 kib mostly unrelated messages follow ] On Wed, 2009-08-19 16:22:29 -0400, John Vogel wrote: > > 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----- > [ 22 kiB mostly unrelated messages follow, including all the messages > attached to the message above ] John, When replying to a message from a mailing list, please quote the related parts of the message you reply to only. I don't want to start a flame war about top-posting, but blindly including a whole message _digest_ is just a waste of bandwidth. Consider the number of copies the messages on a mailing list are stored to. And consider not all the subscribers live behind a 16 Mib/s DSL line - some of them may be connected via GSM modem to the Internet. Also, please hit 'reply' on the message you reply to, as replying to the message digest breaks the threads. 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 --------------------------------------------------------------- From liping.zhang at huawei.com Thu Aug 20 00:28:18 2009 From: liping.zhang at huawei.com (z00132473) Date: Thu, 20 Aug 2009 15:28:18 +0800 Subject: [splint-discuss] =?gb2312?b?tPC4tDogIHBhcnNlciBlcnJvciBvbiBrdGlt?= =?gb2312?b?ZV90IHVzaW5nIHNwbGludCBvbg==?= In-Reply-To: <46B6459B655D7342AB97371E8B7CD8B880FFD6@sv-exch.BBR.local> Message-ID: <000101ca2167$c9f78370$d638a10a@china.huawei.com> I ever tried to ignore system headers by editing "+skip-sys-headers"in .splintrc. But many errors happened as many keywords defined originally in sys headers cann't be known by splint. If I redefined all these keywords I would be a hard work. I think cheating splint may meet the same problem. Liping -----????----- ???: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss-bounces at cs.virginia.edu] ?? Wenzel, Bodo ????: 2009?8?20? 14:54 ???: splint-discuss at mail.cs.virginia.edu ??: Re: [splint-discuss] parser error on ktime_t using splint on Liping, Presumably it is a bad idea to check Linux kernel sources (heavily based on C99/GCC features) with Splint (C90). I won't even try this. ;-) It seems that you like to check your sources that include kernel headers. You might like to ignore those system headers (RTM!) and/or to cheat Splint like suggested in the thread "Problem using splint." Bodo _______________________________________________ splint-discuss mailing list splint-discuss at mail.cs.virginia.edu http://www.cs.virginia.edu/mailman/listinfo/splint-discuss From liping.zhang at huawei.com Thu Aug 20 00:28:18 2009 From: liping.zhang at huawei.com (z00132473) Date: Thu, 20 Aug 2009 15:28:18 +0800 Subject: [splint-discuss] =?gb2312?b?tPC4tDogIHBhcnNlciBlcnJvciBvbiBrdGlt?= =?gb2312?b?ZV90IHVzaW5nIHNwbGludCBvbg==?= In-Reply-To: <46B6459B655D7342AB97371E8B7CD8B880FFD6@sv-exch.BBR.local> Message-ID: <000101ca2167$c9f78370$d638a10a@china.huawei.com> I ever tried to ignore system headers by editing "+skip-sys-headers"in .splintrc. But many errors happened as many keywords defined originally in sys headers cann't be known by splint. If I redefined all these keywords I would be a hard work. I think cheating splint may meet the same problem. Liping -----????----- ???: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss-bounces at cs.virginia.edu] ?? Wenzel, Bodo ????: 2009?8?20? 14:54 ???: splint-discuss at mail.cs.virginia.edu ??: Re: [splint-discuss] parser error on ktime_t using splint on Liping, Presumably it is a bad idea to check Linux kernel sources (heavily based on C99/GCC features) with Splint (C90). I won't even try this. ;-) It seems that you like to check your sources that include kernel headers. You might like to ignore those system headers (RTM!) and/or to cheat Splint like suggested in the thread "Problem using splint." Bodo _______________________________________________ splint-discuss mailing list splint-discuss at mail.cs.virginia.edu http://www.cs.virginia.edu/mailman/listinfo/splint-discuss From brian.quinlan at iolfree.ie Thu Aug 20 12:17:02 2009 From: brian.quinlan at iolfree.ie (Brian Quinlan) Date: Thu, 20 Aug 2009 20:17:02 +0100 Subject: [splint-discuss] =?utf-8?b?562U5aSNOiBwYXJzZXIgZXJyb3Igb24ga3Rp?= =?utf-8?q?me=5Ft_using_splint_on?= In-Reply-To: <000101ca2167$c9f78370$d638a10a@china.huawei.com> References: <000101ca2167$c9f78370$d638a10a@china.huawei.com> Message-ID: <1250795822.10069.14.camel@russell> On Thu, 2009-08-20 at 15:28 +0800, z00132473 wrote: > I ever tried to ignore system headers by editing "+skip-sys-headers"in > .splintrc. > But many errors happened as many keywords defined originally in sys headers > cann't be known by splint. > If I redefined all these keywords I would be a hard work. > > I think cheating splint may meet the same problem. > > Liping Hi Liping, Quite some time ago I faced similar problems with an older Linux kernel and posted my workaround to the list: http://www.cs.virginia.edu/pipermail/splint-discuss/2005-January/000531.html We had a relatively small amount of direct interaction with the kernel, so I didn't have too much pain to go through. However, it was still quite tedious to fix the problems, but in our case, it was worth going through the tedium. You may find some useful hints in that post, but Bodo's advice from his last post may be worth following - there's no guarantee the same exercise will work again with a later kernel version. Bye, Brian From liping.zhang at huawei.com Sun Aug 23 20:41:20 2009 From: liping.zhang at huawei.com (z00132473) Date: Mon, 24 Aug 2009 11:41:20 +0800 Subject: [splint-discuss] error about "report bug to spint-bug@splint.org" Message-ID: <000301ca246c$be7384b0$d638a10a@china.huawei.com> Hi, all I use splint 3.1.2 on linux kernel of ARM project. Now I met a error as below. /***************************************************************/ hsusb.c:1651:3: *** Fatal bug: usymtab_lookup: not found: *__v* *** Last code point: exprNode.c:10317 *** Previous code point: exprNode.c:10317 *** Please report bug to splint-bug at splint.org *** /***********************************************/ The source code of hsusb.c from line 1648 to 1651 is below. /********************************************************/ if ((readl(USB_PORTSC) & PORTSC_PHCD)) { pr_err("%s: cannot clear phcd bit\n", __func__); return -1; } /*****************************************************/ After testing ,I determined that the source code "readl(USB_PORTSC)" results the error,and the definition of "readl" is below. /********************************************* #ifdef __mem_pci #define readl(c) ({ __u32 __v = le32_to_cpu((__force __le32) \ __raw_readl(__mem_pci(c))); __v; }) #elif !defined(readb) #define readl(c) (__readwrite_bug("readl"),0) #endif /*************************************************************/ I do not know what this means. Error in SPLint? Or splint doesn't know the GCC extention? Can anyone help me? Thanks& Best regards! liping -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090824/d9112b4d/attachment.html From roland.illig at gmx.de Mon Aug 24 14:50:34 2009 From: roland.illig at gmx.de (Roland Illig) Date: Mon, 24 Aug 2009 23:50:34 +0200 Subject: [splint-discuss] error about "report bug to spint-bug@splint.org" In-Reply-To: <000301ca246c$be7384b0$d638a10a@china.huawei.com> References: <000301ca246c$be7384b0$d638a10a@china.huawei.com> Message-ID: <4A930B2A.1070507@gmx.de> z00132473 schrieb: > #ifdef __mem_pci > #define readl(c) ({ __u32 __v = le32_to_cpu((__force __le32) \ > __raw_readl(__mem_pci(c))); __v; }) > > #elif !defined(readb) > > #define readl(c) (__readwrite_bug("readl"),0) > > #endif > I do not know what this means. Error in SPLint? Or splint doesn?t know > the GCC extention? It's the latter. SPlint doesn't know the GCC extensions. A workaround I have used is to include a directory of special SPlint headers very early in the compiler's command line. In that directory, there would be a file asm/io.h containing the definition of the function readl(): asm/io.h: #ifndef SPLINT_ASM_IO_H #define SPLINT_ASM_IO_H extern __u32 readl(__u32); #endif Then, call SPlint like: splint -I/my/splint/include -I... ... Roland From Wenzel at bbr-vt.de Mon Aug 24 23:32:58 2009 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Tue, 25 Aug 2009 08:32:58 +0200 Subject: [splint-discuss] error about "report bug to spint-bug@splint.org" Message-ID: <46B6459B655D7342AB97371E8B7CD8B8810322@sv-exch.BBR.local> Liping, The source code you provided is not sufficient to reproduce the problem. Please create a single source file that contains all macros and lines to trigger the error, but reduced to the bare minimum. You might have to search several header files... If you don't know how to do this, I'd suggest to get a good book about C _and_ to read it. ;-) Bodo From shambhu.1980 at gmail.com Tue Aug 25 23:26:23 2009 From: shambhu.1980 at gmail.com (Shambhu Sharma) Date: Wed, 26 Aug 2009 11:56:23 +0530 Subject: [splint-discuss] configuring Splint for a project Message-ID: Hi, I am new to Splint. I want to configure Splint for my project which has 1000+ files. I would like to configure Splint into my Makefile, so that just like building different component using make command, i can run Splint on different component using command something like: make splint . Is there any tutorial or help file for doing the same. I am not sure from where to start to implement the same. I can not simply run "splint ", because there are many global variables are defined through the makefiles to compile any component. Thanks for help, in advance. -- If linux doesn't have a solution, then u have a wrong problem. Shambhu Kumar Sharma Arada Systems 91-98864 91913 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090826/69aff94e/attachment.html From Wenzel at bbr-vt.de Tue Aug 25 23:57:03 2009 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Wed, 26 Aug 2009 08:57:03 +0200 Subject: [splint-discuss] configuring Splint for a project In-Reply-To: References: Message-ID: <46B6459B655D7342AB97371E8B7CD8B88104FA@sv-exch.BBR.local> Well, you have two different tasks here: 1. Find the right commandline to call Splint to check any component. 2. Add this commandline to your Makefile at the right place with the right dependencies. > I can not > simply run "splint ", because there are many global > variables are defined through the makefiles to compile any component. If your compiler is happy, Splint should be happy, too. (That said, only if Splint knows all of the C constructs you use, of course.) For task 1: See the manual, chapter 13.2: You can use the flag "+partial" to check just a single component. When I started using Splint, I called it for each module and for the program as a whole. Since the latter check reports any error the former checks reported before, today only the last check is done. Be sure to add "+top-use" to its commandline. For task 2: My Makefiles with module checks called Splint after the compiler to make sure that the source code is syntactically correct. The compiler is called with the most strict warning levels; Splint does not handle syntax errors very well. ;-) Anyway, you should know how to change your Makefile. Bodo From nido at foxserver.be Wed Aug 26 01:02:02 2009 From: nido at foxserver.be (Nido) Date: Wed, 26 Aug 2009 10:02:02 +0200 Subject: [splint-discuss] configuring Splint for a project In-Reply-To: References: Message-ID: 2009/8/26, Shambhu Sharma : > Hi, > I am new to Splint. I want to configure Splint for my project which > has 1000+ files. I would like to configure Splint into my Makefile, so that > just like building different component using make command, i can run Splint > on different component using command something like: make splint name>. Based on my experience with openbsd ports, it should be possible to do 'make splint key='. > Is there any tutorial or help file for doing the same. I am not sure from > where to start to implement the same. I can not simply run "splint > ", because there are many global variables are defined through the > makefiles to compile any component. I would suggest making a phony target named 'test', or something similar, which runs splint on every component. Another, more make-ish method is to define a %.splint target. Pipe the output of the splint command into tee, and output that in a file. advantage of this is that you keep a log of the latest runs of splint. I recommend you take a look at 'info make'. kind regards, Nido Media From roland.illig at gmx.de Wed Aug 26 15:45:50 2009 From: roland.illig at gmx.de (Roland Illig) Date: Thu, 27 Aug 2009 00:45:50 +0200 Subject: [splint-discuss] configuring Splint for a project In-Reply-To: References: Message-ID: <4A95BB1E.9040605@gmx.de> Shambhu Sharma schrieb: > Hi, > > I am new to Splint. I want to configure Splint for my project > which has 1000+ files. I would like to configure Splint into my > Makefile, so that just like building different component using make > command, i can run Splint on different component using command something > like: make splint . > Is there any tutorial or help file for doing the same. I am not sure > from where to start to implement the same. I can not simply run "splint > ", because there are many global variables are defined through > the makefiles to compile any component. You can also write a compiler wrapper that first calls the real compiler, and if that succeeds, also calls SPlint, passing it the correct flags. As a first idea, have a look at the archive of this mailing list, where I posted one in May 2005. http://www.cs.virginia.edu/pipermail/splint-discuss/2005-May.txt Roland From shambhu.1980 at gmail.com Fri Aug 28 01:44:42 2009 From: shambhu.1980 at gmail.com (Shambhu Sharma) Date: Fri, 28 Aug 2009 14:14:42 +0530 Subject: [splint-discuss] splint-discuss Digest, Vol 59, Issue 12 In-Reply-To: References: Message-ID: Hi Roland, Thanks, i would try that out. On Fri, Aug 28, 2009 at 12:30 AM, wrote: > 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: configuring Splint for a project (Roland Illig) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 27 Aug 2009 00:45:50 +0200 > From: Roland Illig > Subject: Re: [splint-discuss] configuring Splint for a project > To: Discussions about the Splint annotation-assisted static analysis > project > Message-ID: <4A95BB1E.9040605 at gmx.de> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Shambhu Sharma schrieb: > > Hi, > > > > I am new to Splint. I want to configure Splint for my project > > which has 1000+ files. I would like to configure Splint into my > > Makefile, so that just like building different component using make > > command, i can run Splint on different component using command something > > like: make splint . > > Is there any tutorial or help file for doing the same. I am not sure > > from where to start to implement the same. I can not simply run "splint > > ", because there are many global variables are defined through > > the makefiles to compile any component. > > You can also write a compiler wrapper that first calls the real > compiler, and if that succeeds, also calls SPlint, passing it the > correct flags. > > As a first idea, have a look at the archive of this mailing list, where > I posted one in May 2005. > > http://www.cs.virginia.edu/pipermail/splint-discuss/2005-May.txt > > Roland > > > > ------------------------------ > > _______________________________________________ > 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 12 > ********************************************** > -- If linux doesn't have a solution, then u have a wrong problem. Shambhu Kumar Sharma Arada Systems 91-98864 91913 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090828/d703c498/attachment.html From tydeman at tybor.com Mon Aug 31 06:39:39 2009 From: tydeman at tybor.com (Fred J. Tydeman) Date: Mon, 31 Aug 2009 06:39:39 -0700 (PDT) Subject: [splint-discuss] New user and simple program Message-ID: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> I am trying to use splint for the first time. I cannot get it to work on this simple program (test99.c). splint complains about both #error lines. This is on an Intel Pentium 4 running Fedora Core 9 and 10 Linux. The command line is: splint test99.c The program compiles and runs fine with gcc 4.3.2 #include #include #ifndef CHAR_BIT #error ... 1 #endif #if 8 != CHAR_BIT #error ... 2 #endif int main(void){ (void)printf("CHAR_BIT=%i\n", CHAR_BIT); return 0; } --- Fred J. Tydeman Tydeman Consulting tydeman at tybor.com Testing, numerics, programming +1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C") Sample C99+FPCE tests: http://www.tybor.com Savers sleep well, investors eat well, spenders work forever. From ned at bike-nomad.com Mon Aug 31 06:51:34 2009 From: ned at bike-nomad.com (Ned Konz) Date: Mon, 31 Aug 2009 06:51:34 -0700 Subject: [splint-discuss] New user and simple program In-Reply-To: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> References: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> Message-ID: <63F396C6-8987-4A89-A7B7-50518461C5A2@bike-nomad.com> On Aug 31, 2009, at 6:39 AM, Fred J. Tydeman wrote: > I am trying to use splint for the first time. > I cannot get it to work on this simple program (test99.c). > splint complains about both #error lines. > This is on an Intel Pentium 4 running Fedora Core > 9 and 10 Linux. The command line is: splint test99.c > The program compiles and runs fine with gcc 4.3.2 > > #include > #include > #ifndef CHAR_BIT > #error ... 1 > #endif > #if 8 != CHAR_BIT > #error ... 2 > #endif > int main(void){ > (void)printf("CHAR_BIT=%i\n", CHAR_BIT); > return 0; > } Well, is CHAR_BIT defined? If I add a line #define CHAR_BIT 8 at the top, then no errors occur. From ned at bike-nomad.com Mon Aug 31 06:51:34 2009 From: ned at bike-nomad.com (Ned Konz) Date: Mon, 31 Aug 2009 06:51:34 -0700 Subject: [splint-discuss] New user and simple program In-Reply-To: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> References: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> Message-ID: <63F396C6-8987-4A89-A7B7-50518461C5A2@bike-nomad.com> On Aug 31, 2009, at 6:39 AM, Fred J. Tydeman wrote: > I am trying to use splint for the first time. > I cannot get it to work on this simple program (test99.c). > splint complains about both #error lines. > This is on an Intel Pentium 4 running Fedora Core > 9 and 10 Linux. The command line is: splint test99.c > The program compiles and runs fine with gcc 4.3.2 > > #include > #include > #ifndef CHAR_BIT > #error ... 1 > #endif > #if 8 != CHAR_BIT > #error ... 2 > #endif > int main(void){ > (void)printf("CHAR_BIT=%i\n", CHAR_BIT); > return 0; > } Well, is CHAR_BIT defined? If I add a line #define CHAR_BIT 8 at the top, then no errors occur. From derek at knosof.co.uk Mon Aug 31 06:52:30 2009 From: derek at knosof.co.uk (Derek M Jones) Date: Mon, 31 Aug 2009 14:52:30 +0100 Subject: [splint-discuss] New user and simple program In-Reply-To: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> References: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> Message-ID: <4A9BD59E.4020505@knosof.co.uk> Fred, > I am trying to use splint for the first time. > I cannot get it to work on this simple program (test99.c). > splint complains about both #error lines. My guess is that you are using gcc headers. gcc internally calculates the value of the limits macros and creates implementation defined names for these values. In limits.h gcc maps CHAR_BIT etc to these implementation defined macro names created by gcc. The solution is to provide your own limits.h > This is on an Intel Pentium 4 running Fedora Core > 9 and 10 Linux. The command line is: splint test99.c > The program compiles and runs fine with gcc 4.3.2 > > #include > #include > #ifndef CHAR_BIT > #error ... 1 > #endif > #if 8 != CHAR_BIT > #error ... 2 > #endif > int main(void){ > (void)printf("CHAR_BIT=%i\n", CHAR_BIT); > return 0; > } > > --- > Fred J. Tydeman Tydeman Consulting > tydeman at tybor.com Testing, numerics, programming > +1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C") > Sample C99+FPCE tests: http://www.tybor.com > Savers sleep well, investors eat well, spenders work forever. > > _______________________________________________ > splint-discuss mailing list > splint-discuss at mail.cs.virginia.edu > http://www.cs.virginia.edu/mailman/listinfo/splint-discuss > -- Derek M. Jones tel: +44 (0) 1252 520 667 Knowledge Software Ltd mailto:derek at knosof.co.uk Source code analysis http://www.knosof.co.uk From tydeman at tybor.com Mon Aug 31 07:43:58 2009 From: tydeman at tybor.com (Fred J. Tydeman) Date: Mon, 31 Aug 2009 07:43:58 -0700 (PDT) Subject: [splint-discuss] New user and simple program In-Reply-To: <63F396C6-8987-4A89-A7B7-50518461C5A2@bike-nomad.com> Message-ID: <200908311450.n7VEoqhl017434@ares.cs.Virginia.EDU> On Mon, 31 Aug 2009 06:51:34 -0700, Ned Konz wrote: >On Aug 31, 2009, at 6:39 AM, Fred J. Tydeman wrote: > >> #include > >Well, is CHAR_BIT defined? Yes. It is defined in --- Fred J. Tydeman Tydeman Consulting tydeman at tybor.com Testing, numerics, programming +1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C") Sample C99+FPCE tests: http://www.tybor.com Savers sleep well, investors eat well, spenders work forever. From tydeman at tybor.com Mon Aug 31 07:51:51 2009 From: tydeman at tybor.com (Fred J. Tydeman) Date: Mon, 31 Aug 2009 07:51:51 -0700 (PDT) Subject: [splint-discuss] New user and simple program In-Reply-To: <4A9BD59E.4020505@knosof.co.uk> Message-ID: <200908311451.n7VEpwbn017565@ares.cs.Virginia.EDU> On Mon, 31 Aug 2009 14:52:30 +0100, Derek M Jones wrote: >> I am trying to use splint for the first time. >> I cannot get it to work on this simple program (test99.c). >> splint complains about both #error lines. > >My guess is that you are using gcc headers. Correct. >gcc internally calculates the value of the limits macros and >creates implementation defined names for these values. Agreed. >In limits.h gcc maps CHAR_BIT etc to these implementation >defined macro names created by gcc. I looked at the gcc and saw #define CHAR_BIT __CHAR_BIT__ So, I created my own ~/.splintrc file and added -D__CHAR_BIT__=8 That did not help any. >The solution is to provide your own limits.h If that works, that defeats the purpose of using splint to check the gcc implementation of Standard C. But, my quick reading of the splint manual tells me that splint uses its own /usr/share/splint/*/limits.* files to defines things about the headers. I took a quick look at those splint provided files and see that the limits.* files defines things about both and symbols. --- Fred J. Tydeman Tydeman Consulting tydeman at tybor.com Testing, numerics, programming +1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C") Sample C99+FPCE tests: http://www.tybor.com Savers sleep well, investors eat well, spenders work forever. From Michael.Wojcik at MicroFocus.com Mon Aug 31 08:06:13 2009 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Mon, 31 Aug 2009 08:06:13 -0700 Subject: [splint-discuss] New user and simple program In-Reply-To: <4A9BD59E.4020505@knosof.co.uk> References: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> <4A9BD59E.4020505@knosof.co.uk> Message-ID: <81F42F63D5BB344ABF294F8E80990C79084F0C@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss- > bounces at cs.virginia.edu] On Behalf Of Derek M Jones > Sent: Monday, 31 August, 2009 09:53 > To: Fred J. Tydeman > > > I am trying to use splint for the first time. > > I cannot get it to work on this simple program (test99.c). > > splint complains about both #error lines. > > My guess is that you are using gcc headers. > gcc internally calculates the value of the limits macros and creates > implementation defined names for these values. > In limits.h gcc maps CHAR_BIT etc to these implementation defined macro > names created by gcc. > > The solution is to provide your own limits.h I see the same issue Fred described using the MSVC headers. The MSVC limits.h defines CHAR_BIT conventionally. Per my other message, this appears to be a genuine Splint bug. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From tydeman at tybor.com Mon Aug 31 07:43:58 2009 From: tydeman at tybor.com (Fred J. Tydeman) Date: Mon, 31 Aug 2009 07:43:58 -0700 (PDT) Subject: [splint-discuss] New user and simple program In-Reply-To: <63F396C6-8987-4A89-A7B7-50518461C5A2@bike-nomad.com> Message-ID: <200908311510.n7VFApPZ020781@ares.cs.Virginia.EDU> On Mon, 31 Aug 2009 06:51:34 -0700, Ned Konz wrote: >On Aug 31, 2009, at 6:39 AM, Fred J. Tydeman wrote: > >> #include > >Well, is CHAR_BIT defined? Yes. It is defined in --- Fred J. Tydeman Tydeman Consulting tydeman at tybor.com Testing, numerics, programming +1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C") Sample C99+FPCE tests: http://www.tybor.com Savers sleep well, investors eat well, spenders work forever. From Michael.Wojcik at MicroFocus.com Mon Aug 31 08:00:43 2009 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Mon, 31 Aug 2009 08:00:43 -0700 Subject: [splint-discuss] New user and simple program In-Reply-To: <63F396C6-8987-4A89-A7B7-50518461C5A2@bike-nomad.com> References: <200908311339.n7VDdjeR004486@ares.cs.Virginia.EDU> <63F396C6-8987-4A89-A7B7-50518461C5A2@bike-nomad.com> Message-ID: <81F42F63D5BB344ABF294F8E80990C79084F0B@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss- > bounces at cs.virginia.edu] On Behalf Of Ned Konz > Sent: Monday, 31 August, 2009 09:52 > > On Aug 31, 2009, at 6:39 AM, Fred J. Tydeman wrote: > > > I am trying to use splint for the first time. > > I cannot get it to work on this simple program (test99.c). > > splint complains about both #error lines. > > This is on an Intel Pentium 4 running Fedora Core > > 9 and 10 Linux. The command line is: splint test99.c The program > > compiles and runs fine with gcc 4.3.2 > > > > #include > > #include > > #ifndef CHAR_BIT > > #error ... 1 > > #endif > > #if 8 != CHAR_BIT > > #error ... 2 > > #endif > > int main(void){ > > (void)printf("CHAR_BIT=%i\n", CHAR_BIT); return 0; } > > Well, is CHAR_BIT defined? It's required to be defined by limits.h. See ISO 9899-1999 5.2.4.2.1 #1. > If I add a line > > #define CHAR_BIT 8 > > at the top, then no errors occur. Yes. As far as I can tell this is a Splint bug, because CHAR_BIT must be defined by any conforming limits.h (and it's certainly defined by mine). Commenting out the #error directives also removes the error messages from Splint, though they're legal, too (in C90 or C99). This also demonstrates that Splint is aware of the definition of CHAR_BIT, or it'd emit a warning about an unrecognized identifier in the body of main(). (Just verified that, too.) I suspect this is a bug in Splint's handling of the #error preprocessing directive, as nothing else looks like a likely suspect. Unfortunately there's no easy way to suppress #error in the source when checking with Splint, which is the usual workaround for this sort of thing. The simplest solution I can think of (other than fixing Splint - always an option) is a toolchain that copies the source to a set of temporary files with all #error directives commented out, then running Splint on that. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From tydeman at tybor.com Mon Aug 31 10:57:31 2009 From: tydeman at tybor.com (Fred J. Tydeman) Date: Mon, 31 Aug 2009 10:57:31 -0700 (PDT) Subject: [splint-discuss] Internal bug Message-ID: <200908311757.n7VHvel8013957@ares.cs.Virginia.EDU> On Linux, with a command similar to: splint s0000000.c 1>s.lnt 2>s.lnt2 I am getting (in the s.lnt2 file): Splint 3.1.2 --- 05 Sep 2008 cstring.c:47: at source point Command Line: *** Internal Bug at cstring.c:47: llassert failed: cstring_length (s) > 0 [errno: 0] *** Please report bug to splint-bug at splint.org *** (attempting to continue, results may be incorrect) < reading options from /home/tydeman/.splintrc > Standard library: /usr/share/splint/lib/standardstrict.lcd < loading standard library /usr/share/splint/lib/standardstrict.lcd .... > < preprocessing > < more preprocessing . > Preprocessing error for file: /lindata/fpcets/gcc432/c/s0000000.c *** Cannot continue. Since the internal error happens before ~/.splintrc is processed, I assume that my problem is not in my splintrc file. I get the same internal bug with an empty *.c file, so this problem is not due to my *.c file. The preprocessing error here is due to #error because CHAR_BIT is not 8 I assume some shell environment variable is causing this problem. Any suggestions? Any idea which shell environment variables matter to splint? --- Fred J. Tydeman Tydeman Consulting tydeman at tybor.com Testing, numerics, programming +1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C") Sample C99+FPCE tests: http://www.tybor.com Savers sleep well, investors eat well, spenders work forever.