From karthikeyan.n at gmail.com Mon Aug 1 01:10:42 2005 From: karthikeyan.n at gmail.com (Karthikeyan) Date: Wed Mar 22 17:10:59 2006 Subject: [splint-discuss] parse error Message-ID: Hi, I am new to this mailing list. I was using splint tool in my project to debug my applcations inorder to detect the C code checking and I am getting an error such that: file.c:83 Parse Error. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. When I browse thru the code, i found that offsetof is not able to detect which is defined in stddef.h file (system header file). clarify on the above about how to solve this error using splint tool? Thanks for your help! Regards, Karthik From Vijaya.Idimadakala at legerity.com Wed Aug 3 15:58:13 2005 From: Vijaya.Idimadakala at legerity.com (Vijaya.Idimadakala@legerity.com) Date: Wed Mar 22 17:11:02 2006 Subject: [splint-discuss] Unrecognized Identifier: socket Message-ID: Hi all, I am using splint to compile my C Code in linux and I am getting several warnings which i am not able to decipher like: ../common/asynclib.c:147:22: Unrecognized identifier: readlink ../common/asynclib.c:261:8: Unrecognized identifier: gettimeofday ../common/socklib.c:62:22: Unrecognized identifier: socket ../common/socklib.c:62:29: Unrecognized identifier: PF_LOCAL ../common/socklib.c:62:39: Unrecognized identifier: SOCK_STREAM ../common/socklib.c:72:35: Unrecognized identifier: AF_LOCAL ../common/socklib.c:74:13: Unrecognized identifier: bind ../common/socklib.c:81:13: Unrecognized identifier: listen ../common/socklib.c: (in function SockServiceListener) and even some stuff which has been defined in user defined headers is being reported as Unrecognized Identifier. Are these not already defined within the headers? Moreover even the C Complier will be able to discover unrecognized identifiers. So what additional purpose does the Splint check serve? Any help is greatly appreciated, Thanks, Vic -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050803/1747f926/attachment.htm From roland.illig at gmx.de Wed Aug 3 18:39:52 2005 From: roland.illig at gmx.de (Roland Illig) Date: Wed Mar 22 17:11:02 2006 Subject: [splint-discuss] Unrecognized Identifier: socket In-Reply-To: References: Message-ID: <42F147B8.3060500@gmx.de> Vijaya.Idimadakala@legerity.com wrote: > Hi all, > > I am using splint to compile my C Code in linux and I am getting several > warnings which i am not able to decipher like: > > ../common/asynclib.c:147:22: Unrecognized identifier: readlink > ../common/asynclib.c:261:8: Unrecognized identifier: gettimeofday > ../common/socklib.c:62:22: Unrecognized identifier: socket > ../common/socklib.c:62:29: Unrecognized identifier: PF_LOCAL > ../common/socklib.c:62:39: Unrecognized identifier: SOCK_STREAM > ../common/socklib.c:72:35: Unrecognized identifier: AF_LOCAL > ../common/socklib.c:74:13: Unrecognized identifier: bind > ../common/socklib.c:81:13: Unrecognized identifier: listen > ../common/socklib.c: (in function SockServiceListener) > > and even some stuff which has been defined in user defined headers is > being reported as Unrecognized Identifier. > > Are these not already defined within the headers? Moreover even the C > Complier will be able to discover unrecognized identifiers. So what > additional purpose does the Splint check serve? These identifiers are defined in your system's headers, but SPlint does not use these headers. Instead of #includ'ing them a special SPlint library is loaded, which contains definitions of many (but not all) portable functions, types and macros. All these functions are pretty new regarding to the Single Unix Specification. Which SPlint library did you load? posixlib or stdlib? This might help, as these functions are unknown to "Standard C", but are instead defined by POSIX. Roland From ttensi at munichre.com Thu Aug 4 04:25:43 2005 From: ttensi at munichre.com (Tensi Dr. Thomas - Munich-MR - external) Date: Wed Mar 22 17:11:03 2006 Subject: [splint-discuss] unexpected warning for non-static function Message-ID: Dear discussion group, I am new to splint and have a problem with an unexpected warning. For the files tt.h and tt.c as follows == tt.h == void TT_x (void); void TT_y (void); ========== == tt.c == #include "tt.h" void TT_x (void) {} void TT_y (void) { TT_x(); } ========== splint (without any options) produces the warning: tt.h(1,6): Function exported but not used outside tt: TT_x A declaration is exported, but not used outside this module. Declaration can use static qualifier. (Use -exportlocal to inhibit warning) tt.c(2,20): Definition of TT_x Is this correct? When leaving out the call to TT_x in TT_y, splint does not complain any longer. Best regards, Thomas From luke.w.imhoff at medtronic.com Thu Aug 4 09:28:21 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:03 2006 Subject: [splint-discuss] unexpected warning for non-static function Message-ID: <88BB13D21A4BBB409F1F60D31E08252A5778BD@MSPM1BMSGM14.ent.core.medtronic.com> This is just good coding practice for hiding implementation details. If TT_x and TT_y is part of the TT module's interface when you can mark them as /*@unused@*/ and Splint won't complain. == tt.h == /*@unused@*/void TT_x (void); /*@unused@*/void TT_y (void); ========== == tt.c == #include "tt.h" void TT_x (void) {} void TT_y (void) { TT_x(); } ========== If x() and y() really are only used internally in TT and not part of an interface you've defined then you should listen to Splint and then do == tt.c == #include "tt.h" static void TT_x (void); static void TT_y (void); void TT_x (void) {} void TT_y (void) { TT_x(); } ========== -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Tensi Dr. Thomas - Munich-MR - external Sent: Thursday, August 04, 2005 3:26 AM To: splint-discuss@ares.cs.Virginia.EDU Cc: tt@sdm.de Subject: [splint-discuss] unexpected warning for non-static function Dear discussion group, I am new to splint and have a problem with an unexpected warning. For the files tt.h and tt.c as follows == tt.h == void TT_x (void); void TT_y (void); ========== == tt.c == #include "tt.h" void TT_x (void) {} void TT_y (void) { TT_x(); } ========== splint (without any options) produces the warning: tt.h(1,6): Function exported but not used outside tt: TT_x A declaration is exported, but not used outside this module. Declaration can use static qualifier. (Use -exportlocal to inhibit warning) tt.c(2,20): Definition of TT_x Is this correct? When leaving out the call to TT_x in TT_y, splint does not complain any longer. Best regards, Thomas _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From ptp at lysator.liu.se Thu Aug 4 09:32:21 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:03 2006 Subject: [splint-discuss] unexpected warning for non-static function In-Reply-To: References: Message-ID: <20050804133221.GB21523@lysator.liu.se> On Thu, Aug 04, 2005 at 10:25:43AM +0200, Tensi Dr. Thomas - Munich-MR - external wrote: > == tt.h == > void TT_x (void); > void TT_y (void); > ========== > == tt.c == > #include "tt.h" > void TT_x (void) {} > void TT_y (void) { TT_x(); } > ========== > > splint (without any options) produces the warning: > tt.h(1,6): Function exported but not used outside tt: TT_x [...] > Is this correct? When leaving out the call to TT_x in TT_y, > splint does not complain any longer. Section 13 in the splint manual covers it pretty well. It is for sure correct that TT_x has global linkage scope but is only used where file static scope would suffice. The module tt is however not a complete program, and if TT_x is also used in some other module, the warning will disappear if that module is included in the check, since splint will then see TT_x has global usage. Another way to suppress the warning is with the option +partial that tells splint it's only given part of the code and can't see all uses of TT_x. The reason TT_y is not reported is because it is not used at all but is exported. In strict mode however, or with the option +topuse, splint does report: tt.h:2: Function TT_y declared but not used A function is declared but not used. Use /*@unused@*/ in front of function header to suppress message. (Use -fcnuse to inhibit warning) tt.c:3: Definition of TT_y -- Tommy Pettersson From Vijaya.Idimadakala at legerity.com Thu Aug 4 09:38:55 2005 From: Vijaya.Idimadakala at legerity.com (Vijaya.Idimadakala@legerity.com) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] Re: Unrecognized Identifier: socket In-Reply-To: <200508032244.j73MfHMt023742@ares.cs.Virginia.EDU> Message-ID: Hey, I did use +posixlib in my splint compile command. Do I have to specify any location etc? I just used: splint +posixlib ( a lot of other flags) test.c --Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050804/e074cac3/attachment.htm From ok at cs.otago.ac.nz Thu Aug 4 19:00:21 2005 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] unexpected warning for non-static function Message-ID: <200508042300.j74N0LfH357123@atlas.otago.ac.nz> "Imhoff, Luke" wrote: == tt.c == #include "tt.h" static void TT_x (void); static void TT_y (void); void TT_x (void) {} void TT_y (void) { TT_x(); } ========== It is NOT good C style to declare a function one way and define it differently. GCC thinks so too, after snipping out the #include: f% glint tt.c tt.c:4: warning: non-static declaration for `TT_x' follows static tt.c:5: warning: non-static declaration for `TT_y' follows static tt.c:5: warning: `TT_y' defined but not used It would be nice if splint warned about inconsistent declarations like this. The general rule is that a foobar.h file should declare ALL and ONLY the things that belong to foobar.c but are meant to be used by .c files *other than* foobar.c. (Plus of course anything needed for those declarations.) From jds.2005 at verizon.net Thu Aug 4 21:38:42 2005 From: jds.2005 at verizon.net (jds) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] Splint reporting a memory leak when none exists Message-ID: <003c01c5995e$69e70310$2f01a8c0@CompaqS6000Z> Hi; I'm new to Splint, so I'm not sure whether this is a bug or an error on my part. Here's the basic situation, boiled down: #include /*@null@*//*@only@*/ static int* g_int1 = NULL; typedef /*@only@*//*@null@*/ int* pInt; static void killInt(/*@notnull@*/pInt* pi) { free(*pi); *pi = NULL; } int main(/*@unused@*/ int argc, /*@unused@*/ char** argv) { killInt(&g_int1); *g_int1 = (int*)malloc(sizeof(int)); if (NULL != g_int1) *g_int1 = 1; killInt(&g_int1); return 0; } The basic idea is that I want to deallocate my dynamic memory and NULL the associated pointer in a function. This makes more sense in situations where the pointer is to a struct with pointer members that also need to be deallocated. Anyway, Splint reports a memory leak at the malloc line, saying that the only pointer g_int1 has not been deallocated before being assigned. If I explicitly free(g_int1) instead of calling a function to do it, no memory lead reported. I can't figure out how to tell Splint that g_int1 is being deallocated in function killInt(). Any guidance would be appreciated. Thanks, Jerry -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050804/4d8081bc/attachment.htm From ok at cs.otago.ac.nz Thu Aug 4 22:45:05 2005 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] Splint reporting a memory leak when none exists Message-ID: <200508050245.j752j5se365918@atlas.otago.ac.nz> "jds" wrote: I'm new to Splint, ... #include There is no standard header. malloc(), calloc(), realloc(), and free() are in . The system I'm typing on *does* have a , but it *doesn't* declare malloc()... From roland.illig at gmx.de Fri Aug 5 02:40:49 2005 From: roland.illig at gmx.de (Roland Illig) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] Splint reporting a memory leak when none exists In-Reply-To: <003c01c5995e$69e70310$2f01a8c0@CompaqS6000Z> References: <003c01c5995e$69e70310$2f01a8c0@CompaqS6000Z> Message-ID: <42F309F1.3010208@gmx.de> jds wrote: > Anyway, Splint reports a memory leak at the malloc line, saying that > the only pointer g_int1 has not been deallocated before being > assigned. If I explicitly free(g_int1) instead of calling a function > to do it, no memory lead reported. I can't figure out how to tell > Splint that g_int1 is being deallocated in function killInt(). I tried it, but with no complete success. #include /*@null@*//*@only@*/ static int* g_int1 = NULL; typedef /*@only@*//*@null@*/ int* pInt; static void killInt(/*@special@*/ /*@notnull@*/ pInt* pi) /*@releases *pi; @*/ /*@ensures isnull *pi; @*/ { free(*pi); *pi = NULL; } int main(/*@unused@*/ int argc __attribute__((unused)), /*@unused@*/ char** argv __attribute__((unused))) { killInt(&g_int1); g_int1 = (int*)malloc(sizeof(int)); if (NULL != g_int1) *g_int1 = 1; killInt(&g_int1); return 0; } Resulting in this: > Splint 3.1.1 --- 31 May 2005 > foo.c: (in function main) > foo.c:23:12: Function returns with global g_int1 referencing released storage > A global variable does not satisfy its annotations when control is > transferred. (Use -globstate to inhibit warning) > foo.c:21:11: Storage g_int1 released Roland From ptp at lysator.liu.se Fri Aug 5 07:00:40 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] Splint reporting a memory leak when none exists In-Reply-To: <42F309F1.3010208@gmx.de> References: <003c01c5995e$69e70310$2f01a8c0@CompaqS6000Z> <42F309F1.3010208@gmx.de> Message-ID: <20050805110040.GC21523@lysator.liu.se> On Fri, Aug 05, 2005 at 08:40:49AM +0200, Roland Illig wrote: > jds wrote: > >Anyway, Splint reports a memory leak at the malloc line, saying that > >the only pointer g_int1 has not been deallocated before being > >assigned. If I explicitly free(g_int1) instead of calling a function > >to do it, no memory lead reported. I can't figure out how to tell > >Splint that g_int1 is being deallocated in function killInt(). > > I tried it, but with no complete success. I think it was right but you missed that bothersome outermost association of splint annotations; it is not the pInt* that is special, but the pInt, so this makes it work as expected: typedef /*@only@*/ /*@null@*/ /*@special@*/ int* pInt; static void killInt(/*@notnull@*/ pInt* pi) /*@releases *pi; @*/ /*@ensures isnull *pi; @*/ { -- Tommy Pettersson From ptp at lysator.liu.se Fri Aug 5 07:00:40 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] Splint reporting a memory leak when none exists In-Reply-To: <42F309F1.3010208@gmx.de> References: <003c01c5995e$69e70310$2f01a8c0@CompaqS6000Z> <42F309F1.3010208@gmx.de> Message-ID: <20050805110040.GC21523@lysator.liu.se> On Fri, Aug 05, 2005 at 08:40:49AM +0200, Roland Illig wrote: > jds wrote: > >Anyway, Splint reports a memory leak at the malloc line, saying that > >the only pointer g_int1 has not been deallocated before being > >assigned. If I explicitly free(g_int1) instead of calling a function > >to do it, no memory lead reported. I can't figure out how to tell > >Splint that g_int1 is being deallocated in function killInt(). > > I tried it, but with no complete success. I think it was right but you missed that bothersome outermost association of splint annotations; it is not the pInt* that is special, but the pInt, so this makes it work as expected: typedef /*@only@*/ /*@null@*/ /*@special@*/ int* pInt; static void killInt(/*@notnull@*/ pInt* pi) /*@releases *pi; @*/ /*@ensures isnull *pi; @*/ { -- Tommy Pettersson From jds.2005 at verizon.net Fri Aug 5 21:14:05 2005 From: jds.2005 at verizon.net (jds) Date: Wed Mar 22 17:11:04 2006 Subject: [splint-discuss] What about this case (Splint reporting a memory leak when none exists)? Message-ID: <002901c59a24$23ace240$2f01a8c0@CompaqS6000Z> Thank you, everyone, for your very helpful reply. Is there a way to annotate and avoid a memory leak report when another level of indirection is added: #include /*@null@*//*@only@*/ static int* g_int1 = NULL; typedef /*@only@*//*@null@*/ int* pInt; static void killInt(/*@notnull@*/pInt* pi) /*@releases *pi@*/ /*@ensures isnull *pi@*/ { free(*pi); *pi = NULL; } static void killGlobalInt(void) { killInt(&g_int1); } int main(/*@unused@*/ int argc, /*@unused@*/ char** argv) { killGlobalInt(); *g_int1 = (int*)malloc(sizeof(int)); if (NULL != g_int1) *g_int1 = 1; killGlobalInt(); return 0; } Now, killGlobalInt() can't be annotated like killInt(). It is not affecting parameters, and state annotations are not implemented for global variables. Is this a case where such annotation of global variable state changes is needed to avoid a false positive error report? Thanks again, Jerry From ptp at lysator.liu.se Sat Aug 6 04:49:13 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:05 2006 Subject: [splint-discuss] What about this case (Splint reporting a memory leak when none exists)? In-Reply-To: <002901c59a24$23ace240$2f01a8c0@CompaqS6000Z> References: <002901c59a24$23ace240$2f01a8c0@CompaqS6000Z> Message-ID: <20050806084913.GD21523@lysator.liu.se> I was wrong in my latest mail(s). Sorry about that, both the duplicate replies and being wrong. Roland Illig was right. and this is what it should look like: typedef /*@only@*//*@null@*/ int* pInt; static void killInt(/*@special@*//*@notnull@*/pInt* pi) /*@releases *pi@*/ /*@ensures isnull *pi@*/ { free(*pi); *pi = NULL; } The remaining warning from splint in Roland Illig's reply means just what is says. The function main(), and in this new example also the function killGlobalInt(), releases a storage (they both call function killInt() that claims so) that is still reachable (through the global pointer) after the functions end. Splint can't likely know if this is on purpose (that the global pointer *should* be released) by these functions, or if we missed something. So tell splint it is on purpose: static void killGlobalInt(void) /*@globals killed g_int1@*/ { killInt(&g_int1); } int main() /*@globals killed g_int1@*/ { -- Tommy Pettersson From jds.2005 at verizon.net Sat Aug 6 06:24:21 2005 From: jds.2005 at verizon.net (jds) Date: Wed Mar 22 17:11:05 2006 Subject: [splint-discuss] What about this case (Splint reporting a memoryleak when none exists)? References: <002901c59a24$23ace240$2f01a8c0@CompaqS6000Z> <20050806084913.GD21523@lysator.liu.se> Message-ID: <000a01c59a71$0346a2f0$2f01a8c0@CompaqS6000Z> Duh. Should have found that in the manual. However, when I add the annotation: static void killInt(/*@notnull@*/pInt* pi) /*@releases *pi@*/ /*@ensures isnull *pi@*/ { free(*pi); *pi = NULL; } static void killGlobalInt(void) /*@globals killed g_int1@*/ { killInt(&g_int1); } now Splint complains that the global is not actually released before return from killGlobalInt(). It does not seem to be following the call to killInt with its annotations about releasing and nulling the parameter. Curiously, it also now reports that calls to killGlobalInt() have no effect. I'm sorry if I'm being dense. From ptp at lysator.liu.se Sat Aug 6 06:45:04 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:05 2006 Subject: [splint-discuss] What about this case (Splint reporting a memoryleak when none exists)? In-Reply-To: <000a01c59a71$0346a2f0$2f01a8c0@CompaqS6000Z> References: <002901c59a24$23ace240$2f01a8c0@CompaqS6000Z> <20050806084913.GD21523@lysator.liu.se> <000a01c59a71$0346a2f0$2f01a8c0@CompaqS6000Z> Message-ID: <20050806104504.GE21523@lysator.liu.se> On Sat, Aug 06, 2005 at 06:24:21AM -0400, jds wrote: > static void killInt(/*@notnull@*/pInt* pi) You just missed the /*@special@*/: static void killInt(/*@special@*//*@notnull@*/pInt* pi) ^^^^^^^^^^^^^ -- Tommy Pettersson From sune_ahlgren at hotmail.com Mon Aug 8 08:27:48 2005 From: sune_ahlgren at hotmail.com (Sune Ahlgren) Date: Wed Mar 22 17:11:05 2006 Subject: [splint-discuss] How will splint react on a code base where C and C++ is mixed? Message-ID: Hi! I use C and C++ in my programming projects. C where efficency is needed and C++ for improved structure, cleaner interfaces etc. Will splint work at all? Will it go nuts? Do I have to resort to 'Larch C++'? I would prefer to use splint since it seems to be more active and seems to give me better security checks. BRs /Sune _________________________________________________________________ Hitta r?tt p? n?tet med MSN Search http://search.msn.se/ From Vijaya.Idimadakala at legerity.com Tue Aug 9 10:50:48 2005 From: Vijaya.Idimadakala at legerity.com (Vijaya.Idimadakala@legerity.com) Date: Wed Mar 22 17:11:05 2006 Subject: [splint-discuss] How to Make Splint Not Exit In-Reply-To: <200508032244.j73MfHMt023742@ares.cs.Virginia.EDU> Message-ID: Hello All, I would like to know if there is any way in which splint can be made to continue despite the errors and not exit? I am trying to incorporate splint into my make process and it is giving me a host of errors for the 1st file itself and bailing out. Thanks, Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050809/5b81c187/attachment.htm From luke.w.imhoff at medtronic.com Tue Aug 9 11:02:18 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:05 2006 Subject: [splint-discuss] How to Make Splint Not Exit Message-ID: <88BB13D21A4BBB409F1F60D31E08252A578213@MSPM1BMSGM14.ent.core.medtronic.com> Short answer: it depends. If it's a parse error then probably not. If it's something like inline asm then splint is going to puke and exit always. You have to wrap the unparsable in #ifndef S_SPLINT_S // unparsable / asm #endif S_SPLINT_S is defined when splint parses the files, so that will make the unparsable stuff not appear to the parser and hopefully it can get through the rest of the file without that stuff being there. I'd have to know more about the files and the specific error to help more. ________________________________ From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Vijaya.Idimadakala@legerity.com Sent: Tuesday, August 09, 2005 9:51 AM To: splint-discuss@cs.virginia.edu Subject: [splint-discuss] How to Make Splint Not Exit Hello All, I would like to know if there is any way in which splint can be made to continue despite the errors and not exit? I am trying to incorporate splint into my make process and it is giving me a host of errors for the 1st file itself and bailing out. Thanks, Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050809/95c2efba/attachment.htm From Vijaya.Idimadakala at legerity.com Tue Aug 9 12:08:36 2005 From: Vijaya.Idimadakala at legerity.com (Vijaya.Idimadakala@legerity.com) Date: Wed Mar 22 17:11:06 2006 Subject: [splint-discuss] Re: splint-discuss Digest, Vol 17, Issue 2 In-Reply-To: <200508051102.j75B2rMD022830@ares.cs.Virginia.EDU> Message-ID: Hi All, I am getting way too many parse errors with splint. Can anyone tell me how to avoid them. I tried everything mentioned in splint -help parseerros including putting #ifndef S_SPLINT_S around them. Many errors are coming up in the header files and i am not sure how to deal with them. Any help is greatly appreciated. Thank you, Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050809/2aea2b45/attachment.htm From luke.w.imhoff at medtronic.com Tue Aug 9 12:15:09 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:06 2006 Subject: [splint-discuss] Re: splint-discuss Digest, Vol 17, Issue 2 Message-ID: <88BB13D21A4BBB409F1F60D31E08252A57826E@MSPM1BMSGM14.ent.core.medtronic.com> I'd need a code sample to help with parse errors, but the big problems are usually path errors, inline asm, embedded code/nonstandard code features. ________________________________ From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Vijaya.Idimadakala@legerity.com Sent: Tuesday, August 09, 2005 11:09 AM To: splint-discuss@cs.virginia.edu Subject: [splint-discuss] Re: splint-discuss Digest, Vol 17, Issue 2 Hi All, I am getting way too many parse errors with splint. Can anyone tell me how to avoid them. I tried everything mentioned in splint -help parseerros including putting #ifndef S_SPLINT_S around them. Many errors are coming up in the header files and i am not sure how to deal with them. Any help is greatly appreciated. Thank you, Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050809/2c708fb3/attachment.htm From Vijaya.Idimadakala at legerity.com Tue Aug 9 12:38:43 2005 From: Vijaya.Idimadakala at legerity.com (Vijaya.Idimadakala@legerity.com) Date: Wed Mar 22 17:11:06 2006 Subject: [splint-discuss] Parse errors: In-Reply-To: <200508091613.j79G9pqS010969@ares.cs.Virginia.EDU> Message-ID: Here is the code where i am getting the errors: enum{ _PC_LINK_MAX, #define _PC_LINK_MAX _PC_LINK_MAX _PC_MAX_CANON, #define _PC_MAX_CANON _PC_MAX_CANON ................................ and the error is: Parse Error: Non function declaration: _PC_MAX_CANON: int Thanks a million for ur help.. --Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050809/37bf80af/attachment.htm From luke.w.imhoff at medtronic.com Tue Aug 9 12:43:43 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:06 2006 Subject: [splint-discuss] Parse errors: Message-ID: <88BB13D21A4BBB409F1F60D31E08252A57828E@MSPM1BMSGM14.ent.core.medtronic.com> It might be part of your coding idioms, and so you need it for consistence, but did you try putting the defines at the end, I think it's the inline that's making it screw up. Also, why define something when you've already enum'd it? ________________________________ From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Vijaya.Idimadakala@legerity.com Sent: Tuesday, August 09, 2005 11:39 AM To: splint-discuss@cs.virginia.edu Subject: [splint-discuss] Parse errors: Here is the code where i am getting the errors: enum{ _PC_LINK_MAX, #define _PC_LINK_MAX _PC_LINK_MAX _PC_MAX_CANON, #define _PC_MAX_CANON _PC_MAX_CANON ................................ and the error is: Parse Error: Non function declaration: _PC_MAX_CANON: int Thanks a million for ur help.. --Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050809/e4e762c5/attachment.htm From cbfalconer at yahoo.com Tue Aug 9 12:19:23 2005 From: cbfalconer at yahoo.com (CBFalconer) Date: Wed Mar 22 17:11:06 2006 Subject: [splint-discuss] How to Make Splint Not Exit References: <88BB13D21A4BBB409F1F60D31E08252A578213@MSPM1BMSGM14.ent.core.medtronic.com> Message-ID: <42F8D78B.187012DB@yahoo.com> "Imhoff, Luke" wrote: > > Part 1.1.1 Type: Plain Text (text/plain) > Encoding: quoted-printable > > Part 1.2 Type: Plain Text (text/plain) > Encoding: 7bit Please do not use html nor mime attachments in e-mail. They are a potential security hazard, and will normally be ignored at the receiving end. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson From kashwink at hotmail.com Tue Aug 9 16:59:28 2005 From: kashwink at hotmail.com (Kurup Ashwinikumar S) Date: Wed Mar 22 17:11:06 2006 Subject: [splint-discuss] splint install newbie Message-ID: An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050809/e4c95a2a/attachment.htm From cbfalconer at yahoo.com Tue Aug 9 16:25:33 2005 From: cbfalconer at yahoo.com (CBFalconer) Date: Wed Mar 22 17:11:06 2006 Subject: [splint-discuss] Parse errors: References: <88BB13D21A4BBB409F1F60D31E08252A57828E@MSPM1BMSGM14.ent.core.medtronic.com> Message-ID: <42F9113D.4C349F9E@yahoo.com> "Imhoff, Luke" wrote: > > Part 1.1.1 Type: Plain Text (text/plain) > Encoding: quoted-printable > > Part 1.2 Type: Plain Text (text/plain) > Encoding: 7bit There is a whole series of messages similar to this using html and mime encoding. They will go unread in many places, including here, as a security risk. e-mail is a pure text mechanism. -- Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net) Available for consulting/temporary embedded and systems. USE worldnet address! From ok at cs.otago.ac.nz Tue Aug 9 21:25:27 2005 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] Parse errors: Message-ID: <200508100125.j7A1PRMH409570@atlas.otago.ac.nz> Vijaya.Idimadakala@legerity.com wrote: Here is the code where i am getting the errors: enum{ _PC_LINK_MAX, #define _PC_LINK_MAX _PC_LINK_MAX _PC_MAX_CANON, #define _PC_MAX_CANON _PC_MAX_CANON It has to be said that this is surpassing strange code. A macro definition of the form #define means "whenever you see , replace it by ", which could lead to an infinite loop, except that the C89 standard added a rule that basically says "don't expand recursive uses of names", so the effect of the macro is to replace by . What *is* the point of that? There's only one thing it can do: if there is a test #ifdef #ifndef #if ... defined() ... then will appear to be defined, although the definition doesn't actually accomplish anything else, and you certainly can't use the numeric value of the name should it have one. So enum { _PC_LINK_MAX, #define _PC_LINK_MAX _PC_LINK_MAX _PC_MAX_CANON, #define _PC_MAX_CANON _PC_MAX_CANON ... }; is seriously weird. The preprocessor is informed that _PC_LINK_MAX is #defined, but the definition is basically useless. The compiler is informed that _PC_LINK_MAX is another name for the int literal 0, but the preprocessor is not informed of this. By far the simplest thing to do would be to replace the enum by straight macros: #define _PC_LINK_MAX 0 #define _PC_MAX_CANON 1 ... or whatever the actual numbers are. Presumably this is in a file /usr/include/unistd.h or /usr/include/sys/unistd.h or something like that. Make a copy of that file, clean it up, an ensure that Splint looks at that before looking at the original. From winged__wolf at hotmail.com Tue Aug 9 21:15:33 2005 From: winged__wolf at hotmail.com (Aerowolf) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] splint install newbie In-Reply-To: Message-ID: What UNIX is it? What's the 'uname -a' output? -Kyle ________________________________ From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Kurup Ashwinikumar S Sent: Tuesday, August 09, 2005 1:59 PM To: splint-discuss@ares.cs.Virginia.EDU Subject: [splint-discuss] splint install newbie I am trying to build and install splint on a dumb terminal like Unix. It has very basic functionality. The ./configure does absolutely nothing in this case. It exits in 1 sec, without displaying any message. There is not autoconf or automake installed on the version of Unix I am using. However, even to install autoconf, m4 or automake, there are configure scripts, which also exit within a second and there is no creation of make file. I tried using the linux binaries, they dont work. Has some body been able to install splint on a terminal like mine? Is there a generic makefile out there that I could modify in order to build splint on my system? Please advise A K From winged__wolf at hotmail.com Tue Aug 9 21:15:33 2005 From: winged__wolf at hotmail.com (Aerowolf) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] splint install newbie In-Reply-To: Message-ID: What UNIX is it? What's the 'uname -a' output? -Kyle ________________________________ From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Kurup Ashwinikumar S Sent: Tuesday, August 09, 2005 1:59 PM To: splint-discuss@ares.cs.Virginia.EDU Subject: [splint-discuss] splint install newbie I am trying to build and install splint on a dumb terminal like Unix. It has very basic functionality. The ./configure does absolutely nothing in this case. It exits in 1 sec, without displaying any message. There is not autoconf or automake installed on the version of Unix I am using. However, even to install autoconf, m4 or automake, there are configure scripts, which also exit within a second and there is no creation of make file. I tried using the linux binaries, they dont work. Has some body been able to install splint on a terminal like mine? Is there a generic makefile out there that I could modify in order to build splint on my system? Please advise A K From kashwink at hotmail.com Wed Aug 10 09:51:26 2005 From: kashwink at hotmail.com (Kurup Ashwinikumar S) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] splint install newbie Message-ID: An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050810/738030e6/attachment.htm From luke.w.imhoff at medtronic.com Wed Aug 10 12:03:09 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] Annotations for null returns Message-ID: <88BB13D21A4BBB409F1F60D31E08252A57851D@MSPM1BMSGM14.ent.core.medtronic.com> Splint says I need to annotate this function's *menu as /*@returned@*/ since NO_MENU ((Menu *) NULL) is returned, is there anyway to tell splint that this is the null case and in general it will not be returned? Menu* menuChild(/*@null@*/Menu * menu) { return (menu != NO_MENU ? menu->leftChild : NO_MENU); } From fusionfive at comhem.se Wed Aug 10 15:29:41 2005 From: fusionfive at comhem.se (akarl) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] C89 In-Reply-To: <4.3.2.7.2.20050604204127.00aecde0@pop3.demon.co.uk> References: <4.3.2.7.2.20050604204127.00aecde0@pop3.demon.co.uk> Message-ID: <42FA55A5.3060304@comhem.se> Hi all, Is there a way run Splint in ANSI C 89 mode? August From Vijaya.Idimadakala at legerity.com Thu Aug 11 17:17:22 2005 From: Vijaya.Idimadakala at legerity.com (Vijaya.Idimadakala@legerity.com) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] Reinstalling gcc. In-Reply-To: <200508100309.j7A39MVr003942@ares.cs.Virginia.EDU> Message-ID: Hey guys, this doesnt concern splint but i was wondering if any of u know how to recompile gcc. Currently am running gcc as a cross compiler and it produces object code for PowerPC. I would like to install gcc on the PowerPC system itself after which, it should run as a normal compiler. Is there any specific way to go about doing this? Thanks, Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050811/326183e5/attachment.htm From dwh at ovro.caltech.edu Thu Aug 11 17:39:28 2005 From: dwh at ovro.caltech.edu (David Hawkins) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] Reinstalling gcc. In-Reply-To: Message-ID: Hey Vijay, > > this doesnt concern splint but i was wondering if any of u know how > to recompile gcc. Currently am running gcc as a cross compiler and > it produces object code for PowerPC. I would like to install gcc > on the PowerPC system itself after which, it should run as a normal > compiler. Is there any specific way to go about doing this? If you have a PowerPC running gcc and want to compile a newer version of gcc, then you don't need to do anything special. If you want to use the PowerPC cross-compiler to build a PowerPC native compiler, then your 'build' machine is say an x86, your 'host' machine is a PowerPC, and your 'target' is a PowerPC. p10 of The definitive guide to GCC, Wall and von Hagen call this a crossed native compile. Dave From winged__wolf at hotmail.com Sun Aug 14 20:54:08 2005 From: winged__wolf at hotmail.com (Aerowolf) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] splint install newbie In-Reply-To: Message-ID: Does it have a basic /bin/sh? That's what configure uses to run. (is there a config.log or configure.log?) What is the name of the C compiler on that system, and how is it invoked? -Kyle _____ From: Kurup Ashwinikumar S [mailto:kashwink@hotmail.com] Sent: Wednesday, August 10, 2005 6:51 AM To: winged__wolf@hotmail.com Cc: splint-discuss@ares.cs.Virginia.EDU Subject: RE: [splint-discuss] splint install newbie Hi Kyle The uname -a command gives the type as OS/390 MVS1 Thanks, Ashwin What UNIX is it? What's the 'uname -a' output? -Kyle -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050814/e1fb0563/attachment.htm From luke.w.imhoff at medtronic.com Tue Aug 16 10:57:59 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] Abstract types without DMA Message-ID: <88BB13D21A4BBB409F1F60D31E08252A5BBBA3@MSPM1BMSGM14.ent.core.medtronic.com> I'm using splint on a project for a DSP, so an embedded system. It has no heap, so there is no dynamic memory allocation. This poses a conflict with making any of our struct types /*@abstract@*/ since splint wants us to make it a pointer to the struct type for sharing semantics. Is there any way to have the type be abstract, so splint enforces member access and the like, without it complaining about sharing semantics since we need a way to allocate storage statically? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050816/b59a710f/attachment.htm From john.carter at tait.co.nz Wed Aug 17 23:07:49 2005 From: john.carter at tait.co.nz (John Carter) Date: Wed Mar 22 17:11:07 2006 Subject: [splint-discuss] Declaration, definition, scope and reference information. Message-ID: I'm interested in the large scale structure of a large body of C files (>2000) (ie. Which symbols should go in which files, which file should go in which directories and which directories should be subdirectories of other directories.) Basically I believe the correct (best) file and directory structure for this code should be deducible from principles such as coupling and cohesion. However, as the first step one needs complete information on every typedef, struct, union, enum, function and variable declaration, definition and reference. All these files have been chewed over by splint so splint has the information I want somewhere within it bowels. Is there any way of getting splint to spit it out in a machine readable format? Thanks, John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand Carter's Clarification of Murphy's Law. "Things only ever go right so that they may go more spectacularly wrong later." >From this principle, all of life and physics may be deduced. From winged__wolf at hotmail.com Thu Aug 18 03:33:13 2005 From: winged__wolf at hotmail.com (Aerowolf) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Declaration, definition, scope and reference information. In-Reply-To: Message-ID: Splint isn't the best tool for that. Check codeviz, from http://www.csn.ul.ie/~mel/projects/codeviz/ . I recommend its use with ncc, from http://freshmeat.net/projects/ncc . They will generate for themselves -- ncc will actually run gcc to compile it, while parsing it for itself. -Kyle -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of John Carter Sent: Wednesday, August 17, 2005 8:08 PM To: splint-discuss@cs.virginia.edu Subject: [splint-discuss] Declaration, definition,scope and reference information. I'm interested in the large scale structure of a large body of C files (>2000) (ie. Which symbols should go in which files, which file should go in which directories and which directories should be subdirectories of other directories.) Basically I believe the correct (best) file and directory structure for this code should be deducible from principles such as coupling and cohesion. However, as the first step one needs complete information on every typedef, struct, union, enum, function and variable declaration, definition and reference. All these files have been chewed over by splint so splint has the information I want somewhere within it bowels. Is there any way of getting splint to spit it out in a machine readable format? Thanks, John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand Carter's Clarification of Murphy's Law. "Things only ever go right so that they may go more spectacularly wrong later." >From this principle, all of life and physics may be deduced. _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From beebe at math.utah.edu Thu Aug 18 07:16:30 2005 From: beebe at math.utah.edu (Nelson H. F. Beebe) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Declaration, definition,scope and reference Message-ID: John Carter asks about tools for finding typedefs, structs, .... in C code. One venerable formerly-commercial tool is now available under an open-source license: http://sourceforge.net/projects/cscope/ ------------------------------------------------------------------------------- - Nelson H. F. Beebe Tel: +1 801 581 5254 - - University of Utah FAX: +1 801 581 4148 - - Department of Mathematics, 110 LCB Internet e-mail: beebe@math.utah.edu - - 155 S 1400 E RM 233 beebe@acm.org beebe@computer.org - - Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe - ------------------------------------------------------------------------------- From terry-splint at tenberry.com Tue Aug 23 13:02:37 2005 From: terry-splint at tenberry.com (Terry Colligan) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] How do I treat a symbol table? Message-ID: <200508231002.38141.terry-splint@tenberry.com> I'm new to splint, and can't seem to solve a number of problems. I've been reading (and re-reading) the manual, but I can't quite see the big picture. One of my problems is how to treat a symbol table. I need mostly to add malloc'd copies of strings to the symbol table, but the symbol table is initialized with some string literals. The code: // test to show splint problem // enough declarations to keep splint happy typedef struct key key; key *this_key; // make entry in table void add_entry(key *p, // lookup key /*@null@*//*@keep@*/char *value) // value for hey { // whatever, including making entry in symbol table structure // (enough code to solve not-used issues) if (p) if (value) ; else ; else if (value) ; } // remember entry if appropriate void remember(bool appropriate, // decision to add char *value) // value to add { if (appropriate) add_entry(this_key, value); } // make static entry void initialize(void) { add_entry(this_key, "Built-in Symbol"); } The result: ~/C$ splint -ifempty test.c Splint 3.1.1 --- 21 Aug 2005 test.c: (in function remember) test.c:26:3: Variable value is kept in true branch, but not kept in continuation. The state of a variable is different depending on which branch is taken. This means no annotation can sensibly be applied to the storage. (Use -branchstate to inhibit warning) test.c:26:3: in true branch: test.c:26:23: Storage value becomes kept test.c: (in function initialize) test.c:33:22: Unqualified static storage "Built-in Symbol" passed as keep param: add_entry (..., "Built-in Symbol") Static storage is transferred in an inconsistent way. (Use -statictrans to inhibit warning) Finished checking --- 2 code warnings I added the /*@keep@*/ annotation to add_entry() to resolve warnings where splint (correctly, it seems to me) was worried that storage was being lost. Do I misunderstand what /*@keep@*/ is for? Can somebody suggest an alternative? I don't really want to turn off 'branchstate' or 'statictrans' in general -- I want to solve this issue so I don't have to turn off major checking areas. Thanks for considering my problem. -- Terry Terry Colligan terry-splint@tenberry.com Tenberry Software, Inc. http://www.tenberry.com info@tenberry.com phone 1.480.767.8868 fax 1.480.767.8709 From ptp at lysator.liu.se Tue Aug 23 14:07:17 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] How do I treat a symbol table? In-Reply-To: <200508231002.38141.terry-splint@tenberry.com> References: <200508231002.38141.terry-splint@tenberry.com> Message-ID: <20050823180717.GA12643@lysator.liu.se> On Tue, Aug 23, 2005 at 10:02:37AM -0700, Terry Colligan wrote: > One of my problems is how to treat a symbol table. I need > mostly to add malloc'd copies of strings to the symbol table, > but the symbol table is initialized with some string literals. > > The code: [...] I looks like you aren't planning to release any of the memory owned by the symbol table, since you add pointers to string literals to it with no special markings. Then it doesn't make so much sense to track the release responsibility (with /*@keep@*/ et.al.). I think there are some splint markups for garbage collection drive memory handling, so pointers can be used freely but not for releasing the memory. I have never tried it, I'm not sure my memory serves me right, and I don't have time to look it up now, sorry. It's just an idea, not necessarily a good one. -- Tommy Pettersson From luke.w.imhoff at medtronic.com Tue Aug 23 14:16:59 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] How do I treat a symbol table? Message-ID: <88BB13D21A4BBB409F1F60D31E08252A69F425@MSPM1BMSGM14.ent.core.medtronic.com> I think /*@share@*/ is the recommended garbage collected annotation. -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Tommy Pettersson Sent: Tuesday, August 23, 2005 1:07 PM To: splint-discuss@ares.cs.Virginia.EDU Cc: terryc@tenberry.com Subject: Re: [splint-discuss] How do I treat a symbol table? On Tue, Aug 23, 2005 at 10:02:37AM -0700, Terry Colligan wrote: > One of my problems is how to treat a symbol table. I need > mostly to add malloc'd copies of strings to the symbol table, > but the symbol table is initialized with some string literals. > > The code: [...] I looks like you aren't planning to release any of the memory owned by the symbol table, since you add pointers to string literals to it with no special markings. Then it doesn't make so much sense to track the release responsibility (with /*@keep@*/ et.al.). I think there are some splint markups for garbage collection drive memory handling, so pointers can be used freely but not for releasing the memory. I have never tried it, I'm not sure my memory serves me right, and I don't have time to look it up now, sorry. It's just an idea, not necessarily a good one. -- Tommy Pettersson _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From terry-splint at tenberry.com Tue Aug 23 14:49:27 2005 From: terry-splint at tenberry.com (Terry Colligan) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] How do I treat a symbol table? In-Reply-To: <20050823180717.GA12643@lysator.liu.se> References: <200508231002.38141.terry-splint@tenberry.com> <20050823180717.GA12643@lysator.liu.se> Message-ID: <200508231149.27984.terry-splint@tenberry.com> On Tuesday 23 August 2005 11:07 am, Tommy Pettersson wrote: > On Tue, Aug 23, 2005 at 10:02:37AM -0700, Terry Colligan wrote: > > One of my problems is how to treat a symbol table. I need > > mostly to add malloc'd copies of strings to the symbol table, > > but the symbol table is initialized with some string literals. > > > > The code: > [...] > > I looks like you aren't planning to release any of the memory > owned by the symbol table, since you add pointers to string > literals to it with no special markings. That's currently true, but I could add two routines -- one for static string literals, and one for malloc'd strings. > Then it doesn't make so > much sense to track the release responsibility (with /*@keep@*/ > et.al.). I got sucked into using /*@keep@*/ because of the situations where the stored string was, in fact, dynamically allocated. I need an annotation-based solution, rather than a flag-based solution, because I don't want to lose the checking for other dynamically-allocated pointers. > I think there are some splint markups for garbage > collection drive memory handling, so pointers can be used freely > but not for releasing the memory. I have never tried it, I'm not > sure my memory serves me right, and I don't have time to look it > up now, sorry. It's just an idea, not necessarily a good one. I found what you mentioned: the 'shared' attribute. Changing the 'keep' attribute to 'shared' seems to solve this problem. Thanks to Tommy and to Luke Imhoff, who also suggested 'shared' attribute. -- Terry Terry Colligan terry-splint@tenberry.com From terry-splint at tenberry.com Tue Aug 23 16:18:41 2005 From: terry-splint at tenberry.com (Terry Colligan) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers Message-ID: <200508231318.41677.terry-splint@tenberry.com> In code like: // structure type typedef struct node node; struct node { /*@null@*/node next; int value; }; node *first; int look_for_value(int val) { node *n; for (n = first; n; n = n->next) { if (n->value == val) return 23; } return 0; } Why doesn't splint know that the variable 'n' is not null in the body of the loop? If the loop is coded as the equivalent while() loop, splint seems to understand. I get the following output: Splint 3.1.1 --- 21 Aug 2005 test2.c: (in function look_for_value) test2.c:18:14: Arrow access from possibly null pointer n: n->value A possibly null pointer is dereferenced. Value is either the result of a function which may return null (in which case, code should check it is not null), or a global, parameter or structure field declared with the null qualifier. (Use -nullderef to inhibit warning) test2.c:16:30: Storage n may become null Is this a bug in splint? -- Terry Terry Colligan terry-splint@tenberry.com From fusionfive at comhem.se Tue Aug 23 17:55:16 2005 From: fusionfive at comhem.se (akarl) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers In-Reply-To: <200508231318.41677.terry-splint@tenberry.com> References: <200508231318.41677.terry-splint@tenberry.com> Message-ID: <430B9B44.3070207@comhem.se> Terry Colligan wrote: > In code like: > > // structure type > typedef struct node node; > struct node > { > /*@null@*/node next; You probably mean `/*@null@*/node *next;'. > int value; > }; > > node *first; > > int look_for_value(int val) > { > node *n; > for (n = first; n; n = n->next) If you use for (n = first; n != NULL; n = n->next) Splint will be happy. > { > if (n->value == val) > return 23; > } > return 0; > } > > Why doesn't splint know that the variable 'n' is not null > in the body of the loop? > > If the loop is coded as the equivalent while() loop, splint > seems to understand. > > I get the following output: > Splint 3.1.1 --- 21 Aug 2005 > > test2.c: (in function look_for_value) > test2.c:18:14: Arrow access from possibly null pointer n: n->value > A possibly null pointer is dereferenced. Value is either the result of a > function which may return null (in which case, code should check it is not > null), or a global, parameter or structure field declared with the null > qualifier. (Use -nullderef to inhibit warning) > test2.c:16:30: Storage n may become null > > > Is this a bug in splint? > August From fusionfive at comhem.se Tue Aug 23 17:55:16 2005 From: fusionfive at comhem.se (akarl) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers In-Reply-To: <200508231318.41677.terry-splint@tenberry.com> References: <200508231318.41677.terry-splint@tenberry.com> Message-ID: <430B9B44.3070207@comhem.se> Terry Colligan wrote: > In code like: > > // structure type > typedef struct node node; > struct node > { > /*@null@*/node next; You probably mean `/*@null@*/node *next;'. > int value; > }; > > node *first; > > int look_for_value(int val) > { > node *n; > for (n = first; n; n = n->next) If you use for (n = first; n != NULL; n = n->next) Splint will be happy. > { > if (n->value == val) > return 23; > } > return 0; > } > > Why doesn't splint know that the variable 'n' is not null > in the body of the loop? > > If the loop is coded as the equivalent while() loop, splint > seems to understand. > > I get the following output: > Splint 3.1.1 --- 21 Aug 2005 > > test2.c: (in function look_for_value) > test2.c:18:14: Arrow access from possibly null pointer n: n->value > A possibly null pointer is dereferenced. Value is either the result of a > function which may return null (in which case, code should check it is not > null), or a global, parameter or structure field declared with the null > qualifier. (Use -nullderef to inhibit warning) > test2.c:16:30: Storage n may become null > > > Is this a bug in splint? > August From terry-splint at tenberry.com Wed Aug 24 00:12:19 2005 From: terry-splint at tenberry.com (Terry Colligan) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers In-Reply-To: <430B9B44.3070207@comhem.se> References: <200508231318.41677.terry-splint@tenberry.com> <430B9B44.3070207@comhem.se> Message-ID: <200508232112.20162.terry-splint@tenberry.com> On Tuesday 23 August 2005 02:55 pm, akarl wrote: > Terry Colligan wrote: > > In code like: > > > > // structure type > > typedef struct node node; > > struct node > > { > > /*@null@*/node next; > > You probably mean `/*@null@*/node *next;'. I did, indeed. Thanks for catching this! > > int value; > > }; > > > > node *first; > > > > int look_for_value(int val) > > { > > node *n; > > for (n = first; n; n = n->next) > > If you use > > for (n = first; n != NULL; n = n->next) > > Splint will be happy. Splint is indeed happy. However, my client, whom I am trying to switch over to splint is not. This seems to them (and to me) like a bug. One that would require lots of changes in their code (and be uglier code, in their opinion.) Since a naked pointer can be used in if(), while(), etc., and since the documentation alleges that splint works for for() as well, isn't this a bug? It certainly seems so to us! > > { > > if (n->value == val) > > return 23; > > } > > return 0; > > } > > > > Why doesn't splint know that the variable 'n' is not null > > in the body of the loop? > > > > If the loop is coded as the equivalent while() loop, splint > > seems to understand. > > > > I get the following output: > > Splint 3.1.1 --- 21 Aug 2005 > > > > test2.c: (in function look_for_value) > > test2.c:18:14: Arrow access from possibly null pointer n: n->value > > A possibly null pointer is dereferenced. Value is either the result of a > > function which may return null (in which case, code should check it is not > > null), or a global, parameter or structure field declared with the null > > qualifier. (Use -nullderef to inhibit warning) > > test2.c:16:30: Storage n may become null -- Terry Terry Colligan terry-splint@tenberry.com From cbfalconer at yahoo.com Tue Aug 23 18:28:51 2005 From: cbfalconer at yahoo.com (CBFalconer) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers References: <200508231318.41677.terry-splint@tenberry.com> <430B9B44.3070207@comhem.se> Message-ID: <430BA323.E5495D6A@yahoo.com> akarl wrote: > Terry Colligan wrote: > ... snip ... >> >> int look_for_value(int val) >> { >> node *n; >> for (n = first; n; n = n->next) > > If you use > > for (n = first; n != NULL; n = n->next) > > Splint will be happy. In other words it is a splint bug, because both phrases have the exact same meaning. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson From fusionfive at comhem.se Wed Aug 24 09:17:36 2005 From: fusionfive at comhem.se (akarl) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers In-Reply-To: <430BA323.E5495D6A@yahoo.com> References: <200508231318.41677.terry-splint@tenberry.com> <430B9B44.3070207@comhem.se> <430BA323.E5495D6A@yahoo.com> Message-ID: <430C7370.70404@comhem.se> CBFalconer wrote: > akarl wrote: > >>Terry Colligan wrote: >> > > ... snip ... > >>>int look_for_value(int val) >>> { >>> node *n; >>> for (n = first; n; n = n->next) >> >>If you use >> >> for (n = first; n != NULL; n = n->next) >> >>Splint will be happy. > > > In other words it is a splint bug, because both phrases have the > exact same meaning. By default Splint also complains about statements like if (n) { ... } where n is an int, whereas if (n != 0) { ... } is OK. This behavior can be changed with the predboolint option. Maybe we are looking for a predboolptr option here. August From ptp at lysator.liu.se Wed Aug 24 11:19:01 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers In-Reply-To: <430C7370.70404@comhem.se> References: <200508231318.41677.terry-splint@tenberry.com> <430B9B44.3070207@comhem.se> <430BA323.E5495D6A@yahoo.com> <430C7370.70404@comhem.se> Message-ID: <20050824151901.GB12643@lysator.liu.se> On Wed, Aug 24, 2005 at 03:17:36PM +0200, akarl wrote: > By default Splint also complains about statements like > > if (n) { ... } > > where n is an int, whereas > > if (n != 0) { ... } > > is OK. This behavior can be changed with the predboolint option. Maybe > we are looking for a predboolptr option here. The pred-bool-ptr option exists and muffles if (ptr) and if (!ptr) but it doesn't convince splint that ptr really is or isn't NULL for some mysterious reason. Bug or not, I think it would be great if it did so, although thinking won't change splint... -- Tommy Pettersson From terry-splint at tenberry.com Wed Aug 24 12:08:58 2005 From: terry-splint at tenberry.com (Terry Colligan) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers In-Reply-To: <20050824151901.GB12643@lysator.liu.se> References: <200508231318.41677.terry-splint@tenberry.com> <430C7370.70404@comhem.se> <20050824151901.GB12643@lysator.liu.se> Message-ID: <200508240908.58699.terry-splint@tenberry.com> On Wednesday 24 August 2005 08:19 am, Tommy Pettersson wrote: > On Wed, Aug 24, 2005 at 03:17:36PM +0200, akarl wrote: > > By default Splint also complains about statements like > > > > if (n) { ... } > > > > where n is an int, whereas > > > > if (n != 0) { ... } > > > > is OK. This behavior can be changed with the predboolint option. Maybe > > we are looking for a predboolptr option here. > > The pred-bool-ptr option exists and muffles > > if (ptr) > > and > > if (!ptr) > > but it doesn't convince splint that ptr really is or isn't > NULL for some mysterious reason. Bug or not, I think it would > be great if it did so, although thinking won't change splint... Actually, the above isn't quite correct -- splint IS convinced that ptr really is NULL for if() and while() -- just not for for(). For example, in: ============= // test of splint problem // structure type typedef struct node node; struct node { /*@null@*/node *next; int value; }; node *first; /*@-predboolptr@*/ int look_for_value(int val) { node *n; // coded as a for() loop -- splint complains for (n = first; n; n = n->next) { if (n->value == val) return 23; } // coded as a while() loop -- splint is happy n = first; while (n) { if (n->value == val) return 23; n = n->next; } // coded as an if() test -- splint is happy n = first; loop: if (n) { if (n->value == val) return 23; n = n->next; goto loop; } return 0; } ====== splint complains about the 'n->value' in the for() loop, but not in the if() or while() loops: =========== ~/splint$ splint -exportlocal test2.c Splint 3.1.1 --- 21 Aug 2005 test2.c: (in function look_for_value) test2.c:21:14: Arrow access from possibly null pointer n: n->value A possibly null pointer is dereferenced. Value is either the result of a function which may return null (in which case, code should check it is not null), or a global, parameter or structure field declared with the null qualifier. (Use -nullderef to inhibit warning) test2.c:19:30: Storage n may become null Finished checking --- 1 code warning ========== This seems clearly to be a bug. I have copied splint-bug to amend my earlier report of this problem. -- Terry Terry Colligan terry-splint@tenberry.com From ptp at lysator.liu.se Wed Aug 24 12:15:56 2005 From: ptp at lysator.liu.se (Tommy Pettersson) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] How do I treat a symbol table? In-Reply-To: <200508231149.27984.terry-splint@tenberry.com> References: <200508231002.38141.terry-splint@tenberry.com> <20050823180717.GA12643@lysator.liu.se> <200508231149.27984.terry-splint@tenberry.com> Message-ID: <20050824161556.GC12643@lysator.liu.se> On Tue, Aug 23, 2005 at 11:49:27AM -0700, Terry Colligan wrote: > > I looks like you aren't planning to release any of the memory > > owned by the symbol table, since you add pointers to string > > literals to it with no special markings. > > That's currently true, but I could add two routines -- one > for static string literals, and one for malloc'd strings. Ok. Then the problem will be that splint is made for static checking of the source, but the symbol table will have pointers of two different types (as splint sees it: owners and observers) that are only known at run time. It doesn't mean splint will be useless, but you'll have to expect splint to not handle some parts of the code and generate irrelevant warnings. > I need an annotation-based solution, rather than a flag-based > solution, because I don't want to lose the checking for other > dynamically-allocated pointers. You can control the flags with splint comments in the source code (section 1.3.2 in the manual). Example: /*@-some_flag +some_other_flag@*/ some code; /*@=some_flag =some_other_flag@*/ -- Tommy Pettersson From fusionfive at comhem.se Wed Aug 24 20:27:23 2005 From: fusionfive at comhem.se (akarl) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Loops over pointers In-Reply-To: <20050824151901.GB12643@lysator.liu.se> References: <200508231318.41677.terry-splint@tenberry.com> <430B9B44.3070207@comhem.se> <430BA323.E5495D6A@yahoo.com> <430C7370.70404@comhem.se> <20050824151901.GB12643@lysator.liu.se> Message-ID: <430D106B.6090807@comhem.se> Tommy Pettersson wrote: > On Wed, Aug 24, 2005 at 03:17:36PM +0200, akarl wrote: > >>By default Splint also complains about statements like >> >> if (n) { ... } >> >>where n is an int, whereas >> >> if (n != 0) { ... } >> >>is OK. This behavior can be changed with the predboolint option. Maybe >>we are looking for a predboolptr option here. > > > The pred-bool-ptr option exists and muffles > > if (ptr) > > and > > if (!ptr) > > but it doesn't convince splint that ptr really is or isn't > NULL for some mysterious reason. Bug or not, I think it would > be great if it did so, although thinking won't change splint... OK, then it's most certainly a bug. August From l_rm at yahoo.com Mon Aug 29 05:09:37 2005 From: l_rm at yahoo.com (Lee) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Parse Error Message-ID: <20050829090937.48097.qmail@web40807.mail.yahoo.com> I have just started working with C and splint (Java and O-O background) but am having a little trouble getting past a parse error. I have simplified the code to demonstrate the problem: ----------------------------- int main() { int good; if(true){} int fail; return(0); } ----------------------------- I get the following error: C:\\>splint +ansi-lib +trytorecover test.c Splint 3.1.1 --- 12 April 2003 test.c: (in function main) test.c(6,4): Parse Error. Attempting to continue. test.c(6,4): Cannot recover from parse error. *** Cannot continue. Note that line 6 is 'int fail;' I have tried variations of the flags with no effect, also changing the if statement to another logic statement as below, also causes the parse error: int good = 2; good = (good -1) * 10; This is under Windows XP (Home) SP1 with the GCC includes from DEV-C++ 4.9.9.0 I haven't been able to test this problem with other platforms or libraries. Is this a bug with splint, or is it a rule with C that all declaration statements must be before any logic statements. The program I initially had this problem in compiles and runs correctly. Any help you could give would be appreciated. Lee. ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs From y at 500mg.com Mon Aug 29 05:39:03 2005 From: y at 500mg.com (yamada) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Parse Error In-Reply-To: <20050829090937.48097.qmail@web40807.mail.yahoo.com> References: <20050829090937.48097.qmail@web40807.mail.yahoo.com> Message-ID: <4312D7B7.1000308@500mg.com> Hello Lee, Just move the "int fail;" line to the next of "int good;" line. GNU C is support C++ like declaration, but splint is not. yamada Lee wrote: > I have just started working with C and splint (Java and O-O > background) but am having a little trouble getting past a > parse error. I have simplified the code to demonstrate the > problem: > ----------------------------- > > int main() > { > int good; > if(true){} > int fail; > return(0); > } > > ----------------------------- > I get the following error: > C:\\>splint +ansi-lib +trytorecover > test.c > Splint 3.1.1 --- 12 April 2003 > > test.c: (in function main) > test.c(6,4): Parse Error. Attempting to continue. > test.c(6,4): Cannot recover from parse error. > *** Cannot continue. > > Note that line 6 is 'int fail;' > I have tried variations of the flags with no effect, also > changing the if statement to another logic statement as > below, also causes the parse error: > > int good = 2; > good = (good -1) * 10; > > This is under Windows XP (Home) SP1 with the GCC includes > from DEV-C++ 4.9.9.0 > I haven't been able to test this problem with other > platforms or libraries. > > Is this a bug with splint, or is it a rule with C that all > declaration statements must be before any logic statements. > The program I initially had this problem in compiles and > runs correctly. > > Any help you could give would be appreciated. > > Lee. > > > > ____________________________________________________ > Start your day with Yahoo! - make it your home page > http://www.yahoo.com/r/hs > > _______________________________________________ > splint-discuss mailing list > splint-discuss@ares.cs.Virginia.EDU > http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From mne at mosaic-ag.com Mon Aug 29 05:42:02 2005 From: mne at mosaic-ag.com (Miroslaw Dobrzanski-Neumann) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Parse Error In-Reply-To: <20050829090937.48097.qmail@web40807.mail.yahoo.com> References: <20050829090937.48097.qmail@web40807.mail.yahoo.com> Message-ID: <20050829094202.GA5134@mailsrv.mosaic-ag.com> On Mon, Aug 29, 2005 at 02:09:37AM -0700, Lee wrote: > I have just started working with C and splint (Java and O-O > background) but am having a little trouble getting past a > parse error. I have simplified the code to demonstrate the > problem: > ----------------------------- > > int main() > { > int good; > if(true){} > int fail; > return(0); > } try with gcc -pedantic In pre C99 all declarations must apear before any statement in a block the correct code int main () { int good; int fail; if(true){} return(0); } -- Miros?aw Dobrza?ski-Neumann E-mail: mne@mosaic-ag.com ------- L E G A L D I S C L A I M E R --------- Die Informationen in dieser Nachricht sind vertraulich und ausschliesslich fuer den Adressaten bestimmt. Kenntnisnahme durch Dritte ist unzulaessig. Die Erstellung von Kopien oder das Weiterleiten an weitere, nicht originaere und benannte Adressaten ist nicht vorgesehen und kann ungesetzlich sein. Die Meinungen in dieser Nachricht stellen lediglich die Meinungen des Senders dar. Falls Sie vermuten, dass diese Nachricht veraendert wurde, setzen Sie sich mit dem Absender in Verbindung. Der Absender uebernimmt ohne weitere Ueberpruefung keine Verantwortung fuer die Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte Empfaenger werden gebeten, die Vertraulichkeit der Nachricht zu wahren und den Absender sofort ueber einen Uebertragungsfehler zu informieren. ------------------------------------------------------ From mne at mosaic-ag.com Mon Aug 29 05:42:02 2005 From: mne at mosaic-ag.com (Miroslaw Dobrzanski-Neumann) Date: Wed Mar 22 17:11:08 2006 Subject: [splint-discuss] Parse Error In-Reply-To: <20050829090937.48097.qmail@web40807.mail.yahoo.com> References: <20050829090937.48097.qmail@web40807.mail.yahoo.com> Message-ID: <20050829094202.GA5134@mailsrv.mosaic-ag.com> On Mon, Aug 29, 2005 at 02:09:37AM -0700, Lee wrote: > I have just started working with C and splint (Java and O-O > background) but am having a little trouble getting past a > parse error. I have simplified the code to demonstrate the > problem: > ----------------------------- > > int main() > { > int good; > if(true){} > int fail; > return(0); > } try with gcc -pedantic In pre C99 all declarations must apear before any statement in a block the correct code int main () { int good; int fail; if(true){} return(0); } -- Miros?aw Dobrza?ski-Neumann E-mail: mne@mosaic-ag.com ------- L E G A L D I S C L A I M E R --------- Die Informationen in dieser Nachricht sind vertraulich und ausschliesslich fuer den Adressaten bestimmt. Kenntnisnahme durch Dritte ist unzulaessig. Die Erstellung von Kopien oder das Weiterleiten an weitere, nicht originaere und benannte Adressaten ist nicht vorgesehen und kann ungesetzlich sein. Die Meinungen in dieser Nachricht stellen lediglich die Meinungen des Senders dar. Falls Sie vermuten, dass diese Nachricht veraendert wurde, setzen Sie sich mit dem Absender in Verbindung. Der Absender uebernimmt ohne weitere Ueberpruefung keine Verantwortung fuer die Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte Empfaenger werden gebeten, die Vertraulichkeit der Nachricht zu wahren und den Absender sofort ueber einen Uebertragungsfehler zu informieren. ------------------------------------------------------ From ok at cs.otago.ac.nz Mon Aug 29 20:08:46 2005 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Parse Error Message-ID: <200508300008.j7U08kYT072375@atlas.otago.ac.nz> Lee wrote: int main() { int good; if(true){} int fail; <---- NOT LEGAL in C89. return(0); } I don't think Splint understands C99 extensions yet. In C89, the declarations in a block must precede the statements. You need int main() { int good; int fail; if (true) {} return 0; } You did *check* a good book about C at some point, right? From luke.w.imhoff at medtronic.com Tue Aug 30 10:02:44 2005 From: luke.w.imhoff at medtronic.com (Imhoff, Luke) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Parse Error Message-ID: <88BB13D21A4BBB409F1F60D31E08252A70FE95@MSPM1BMSGM14.ent.core.medtronic.com> Splint should be tunable to standard your code is aiming for (i.e. which Cxx), not the other way around. The C99 declarations help limit variable scope, which is always a good practice. Is Splint still being actively developed outside of bug fixes? -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Richard A. O'Keefe Sent: Monday, August 29, 2005 7:09 PM To: splint-discuss@cs.virginia.edu Subject: Re: [splint-discuss] Parse Error Lee wrote: int main() { int good; if(true){} int fail; <---- NOT LEGAL in C89. return(0); } I don't think Splint understands C99 extensions yet. In C89, the declarations in a block must precede the statements. You need int main() { int good; int fail; if (true) {} return 0; } You did *check* a good book about C at some point, right? _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From jds.2005 at verizon.net Wed Aug 31 09:06:45 2005 From: jds.2005 at verizon.net (jds.2005@verizon.net) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Splint run time Message-ID: <11541407.1125493605853.JavaMail.root@vms071.mailsrvcs.net> Hi; I have a directory of 109 source files, maybe 300,000 lines of code. When I run splint on *.c, it churns away for hours. After 10 hours, it's processed about half the files. Smaller directories (e.g. 44 source files) run in minutes. I'm running the latest splint version on recent P4 WinXP machine. The disk churns a lot - one possibility is limited memory and lots of page faults. Is this likely to be a Windows issue? Are there characteristics of the code that can dramatically increase run time like this? Any insights or ideas would be appreciated. Thanks, Jerry From sr7 at agere.com Wed Aug 31 09:29:04 2005 From: sr7 at agere.com (Rothweiler, Steven (Steve)) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Splint run time Message-ID: > > I have a directory of 109 source files, maybe 300,000 lines > of code. When I run splint on *.c, it churns away for hours. > After 10 hours, it's processed about half the files. Smaller > directories (e.g. 44 source files) run in minutes. > > I'm running the latest splint version on recent P4 WinXP > machine. The disk churns a lot - one possibility is limited > memory and lots of page faults. > > Is this likely to be a Windows issue? Are there > characteristics of the code that can dramatically increase > run time like this? > > Any insights or ideas would be appreciated. > I'd bet a lot of money that the splint process is thrashing. Check the Task Manager, to see if the splint process is getting any of the CPU. If it's getting less than 3% or so, then the splint process is thrashing. Try splitting up the splint runs into two runs, each on half the files. Then try splitting it into quarters, etc... -- STeve From sr7 at agere.com Wed Aug 31 09:29:04 2005 From: sr7 at agere.com (Rothweiler, Steven (Steve)) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Splint run time Message-ID: > > I have a directory of 109 source files, maybe 300,000 lines > of code. When I run splint on *.c, it churns away for hours. > After 10 hours, it's processed about half the files. Smaller > directories (e.g. 44 source files) run in minutes. > > I'm running the latest splint version on recent P4 WinXP > machine. The disk churns a lot - one possibility is limited > memory and lots of page faults. > > Is this likely to be a Windows issue? Are there > characteristics of the code that can dramatically increase > run time like this? > > Any insights or ideas would be appreciated. > I'd bet a lot of money that the splint process is thrashing. Check the Task Manager, to see if the splint process is getting any of the CPU. If it's getting less than 3% or so, then the splint process is thrashing. Try splitting up the splint runs into two runs, each on half the files. Then try splitting it into quarters, etc... -- STeve From spam_account at sympatico.ca Wed Aug 31 09:58:56 2005 From: spam_account at sympatico.ca (spam_account@sympatico.ca) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Splint run time In-Reply-To: <11541407.1125493605853.JavaMail.root@vms071.mailsrvcs.net> References: <11541407.1125493605853.JavaMail.root@vms071.mailsrvcs.net> Message-ID: On 31 Aug 2005, jds.2005@verizon.net wrote: > I have a directory of 109 source files, maybe 300,000 lines of code. > When I run splint on *.c, it churns away for hours. After 10 hours, > it's processed about half the files. Smaller directories (e.g. 44 > source files) run in minutes. I have the same problem on Linux (with a slow AMD K6/2 300Mhz). If you use the single-include option and use pre-compiled system headers, you can speed things up dramatically. Here are the option I was using to start with. splint +single-include +weak +unixlib +limit 1 +its4mostrisky +partial +top-use +const-use +export-local +internal-name-look-alike +retval -typeuse -fcnuse Once weak checking produces little or no output, you can increase the verbosity. hth, Bill Pringlemeir. From spam_account at sympatico.ca Wed Aug 31 09:58:56 2005 From: spam_account at sympatico.ca (spam_account@sympatico.ca) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Splint run time In-Reply-To: <11541407.1125493605853.JavaMail.root@vms071.mailsrvcs.net> References: <11541407.1125493605853.JavaMail.root@vms071.mailsrvcs.net> Message-ID: On 31 Aug 2005, jds.2005@verizon.net wrote: > I have a directory of 109 source files, maybe 300,000 lines of code. > When I run splint on *.c, it churns away for hours. After 10 hours, > it's processed about half the files. Smaller directories (e.g. 44 > source files) run in minutes. I have the same problem on Linux (with a slow AMD K6/2 300Mhz). If you use the single-include option and use pre-compiled system headers, you can speed things up dramatically. Here are the option I was using to start with. splint +single-include +weak +unixlib +limit 1 +its4mostrisky +partial +top-use +const-use +export-local +internal-name-look-alike +retval -typeuse -fcnuse Once weak checking produces little or no output, you can increase the verbosity. hth, Bill Pringlemeir.