From Forrest.Sun at med.ge.com Wed Feb 11 13:51:13 2009 From: Forrest.Sun at med.ge.com (Sun, Forrest (GE Healthcare)) Date: Wed, 11 Feb 2009 16:51:13 -0500 Subject: [splint-discuss] install splint Message-ID: <8BC7D3BD84751245B2EF0731B37F02F203C425F1@ALPMLVEM07.e2k.ad.ge.com> Has anyone encountered the following error during installation splint 3.2.1? After configure, run make: Compiling multiVal.c... Compiling lltok.c... Compiling sRef.c... Compiling lcllib.c... Compiling randomNumbers.c... Compiling fileLib.c... Compiling globals.c... Compiling flags.c... Compiling general.c... Compiling osd.c... osd.c: In function `osd_getPid': osd.c:519: error: `__pid_t' undeclared (first use in this function) osd.c:519: error: (Each undeclared identifier is reported only once osd.c:519: error: for each function it appears in.) osd.c:519: error: syntax error before "pid" osd.c:522: error: `pid' undeclared (first use in this function) make[3]: *** [osd.o] Error 1 I tried on Solaris 5.7 and AIX 5.1 and got the same error. Any ideas what to do? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090211/3d26605e/attachment-0001.html From splint at sympatico.ca Mon Feb 16 14:40:18 2009 From: splint at sympatico.ca (Bill Pringlemeir) Date: Mon, 16 Feb 2009 17:40:18 -0500 Subject: [splint-discuss] install splint In-Reply-To: <8BC7D3BD84751245B2EF0731B37F02F203C425F1@ALPMLVEM07.e2k.ad.ge.com> (Forrest Sun's message of "Wed, 11 Feb 2009 16:51:13 -0500") References: <8BC7D3BD84751245B2EF0731B37F02F203C425F1@ALPMLVEM07.e2k.ad.ge.com> Message-ID: <87hc2uypil.fsf@sympatico.ca> On 11 Feb 2009, Forrest.Sun at med.ge.com wrote: > Has anyone encountered the following error during installation splint > 3.2.1? [snip] > osd.c: In function `osd_getPid': > osd.c:519: error: `__pid_t' undeclared (first use in this function) A search on 'splint pid_t' or 'splint __pid_t' might help. That might [eventually] take you here, http://www.cs.virginia.edu/pipermail/splint-discuss/2008-August/001207.html I think it was fixed in CVS? 'pid_t' is the better variant to use. It looks like your platform(s) has the same problem as the Mac poster? Can you try with the CVS version (which is composed only of bug fixes and no new feature (with additional bugs)). fwiw, Bill Pringlemeir. -- Some people are alive because it's against the law to kill them. From splint at sympatico.ca Mon Feb 16 14:40:18 2009 From: splint at sympatico.ca (Bill Pringlemeir) Date: Mon, 16 Feb 2009 17:40:18 -0500 Subject: [splint-discuss] install splint In-Reply-To: <8BC7D3BD84751245B2EF0731B37F02F203C425F1@ALPMLVEM07.e2k.ad.ge.com> (Forrest Sun's message of "Wed, 11 Feb 2009 16:51:13 -0500") References: <8BC7D3BD84751245B2EF0731B37F02F203C425F1@ALPMLVEM07.e2k.ad.ge.com> Message-ID: <87hc2uypil.fsf@sympatico.ca> On 11 Feb 2009, Forrest.Sun at med.ge.com wrote: > Has anyone encountered the following error during installation splint > 3.2.1? [snip] > osd.c: In function `osd_getPid': > osd.c:519: error: `__pid_t' undeclared (first use in this function) A search on 'splint pid_t' or 'splint __pid_t' might help. That might [eventually] take you here, http://www.cs.virginia.edu/pipermail/splint-discuss/2008-August/001207.html I think it was fixed in CVS? 'pid_t' is the better variant to use. It looks like your platform(s) has the same problem as the Mac poster? Can you try with the CVS version (which is composed only of bug fixes and no new feature (with additional bugs)). fwiw, Bill Pringlemeir. -- Some people are alive because it's against the law to kill them. From plongstaff at rogers.com Sun Feb 22 16:51:54 2009 From: plongstaff at rogers.com (Phil Longstaff) Date: Sun, 22 Feb 2009 19:51:54 -0500 Subject: [splint-discuss] Splint and malloc Message-ID: <200902221951.54430.plongstaff@rogers.com> Is there any way of indicating to splint that if a struct with pointers is malloc'ed and the pointers are given values, that the previous values don't need to be freed because it is new memory? Example: typedef struct { char* x; } struct_t; struct_t* s = malloc( sizeof(struct_t) ); s.x = malloc(10); will give a warning that s.x is implied only and hasn't been freed, leading to memory leak. However, since s is pointing to new storage, there isn't anything to be freed. Phil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090222/56fe7bbf/attachment.html From roland.illig at gmx.de Mon Feb 23 01:35:48 2009 From: roland.illig at gmx.de (Roland Illig) Date: Mon, 23 Feb 2009 10:35:48 +0100 Subject: [splint-discuss] Splint and malloc In-Reply-To: <200902221951.54430.plongstaff@rogers.com> References: <200902221951.54430.plongstaff@rogers.com> Message-ID: <49A26DF4.2050005@gmx.de> Phil Longstaff schrieb: > Is there any way of indicating to splint that if a struct with pointers > is malloc'ed and the pointers are given values, that the previous values > don't need to be freed because it is new memory? > > Example: > > typedef struct { > > char* x; > > } struct_t; > > struct_t* s = malloc( sizeof(struct_t) ); > > s.x = malloc(10); > > will give a warning that s.x is implied only and hasn't been freed, > leading to memory leak. However, since s is pointing to new storage, > there isn't anything to be freed. The warning wants to tell you that you need to free s->x (not s.x) later. This works for me: #include #include typedef struct { char* x; } struct_t; int main(void) { struct_t* s; s = malloc( sizeof(struct_t) ); assert(s != NULL); s->x = malloc(10); /* ... */ free(s->x); free(s); return 0; } Roland From plongstaff at rogers.com Mon Feb 23 10:15:43 2009 From: plongstaff at rogers.com (Phil Longstaff) Date: Mon, 23 Feb 2009 13:15:43 -0500 Subject: [splint-discuss] Splint and malloc In-Reply-To: <49A26DF4.2050005@gmx.de> References: <200902221951.54430.plongstaff@rogers.com> <49A26DF4.2050005@gmx.de> Message-ID: <200902231315.44036.plongstaff@rogers.com> On February 23, 2009 04:35:48 am Roland Illig wrote: > Phil Longstaff schrieb: > > Is there any way of indicating to splint that if a struct with pointers > > is malloc'ed and the pointers are given values, that the previous values > > don't need to be freed because it is new memory? > > > > Example: > > > > typedef struct { > > > > char* x; > > > > } struct_t; > > > > struct_t* s = malloc( sizeof(struct_t) ); > > > > s.x = malloc(10); > > > > will give a warning that s.x is implied only and hasn't been freed, > > leading to memory leak. However, since s is pointing to new storage, > > there isn't anything to be freed. > > The warning wants to tell you that you need to free s->x (not s.x) > later. This works for me: > > #include > #include > > typedef struct { > char* x; > } struct_t; > > int main(void) > { > struct_t* s; > > s = malloc( sizeof(struct_t) ); > assert(s != NULL); > s->x = malloc(10); > > /* ... */ > > free(s->x); > free(s); > > return 0; > } Yes, I meant s->x not s.x. I find that I'm asking the wrong question. s = malloc(sizeof(struct_t)) s->x = ... produces no warnings, whereas s = g_malloc(sizeof(struct_t)) s->x = ... produces the warning that implicitly only storage s->x is not freed before the assignment. g_malloc() is the version of malloc included in glib on linux (library.gnome.org/devel/glib/). Maybe splint knows about malloc and that it always returns fresh storage. Is there any way to tell it that g_malloc also returns fresh storage (the same way I can use -booltype to tell it that gboolean is a boolean type)? Phil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090223/e5fdf859/attachment.html From plongstaff at rogers.com Mon Feb 23 10:32:49 2009 From: plongstaff at rogers.com (Phil Longstaff) Date: Mon, 23 Feb 2009 13:32:49 -0500 Subject: [splint-discuss] Splint and malloc In-Reply-To: <200902231315.44036.plongstaff@rogers.com> References: <200902221951.54430.plongstaff@rogers.com> <49A26DF4.2050005@gmx.de> <200902231315.44036.plongstaff@rogers.com> Message-ID: <200902231332.50147.plongstaff@rogers.com> On February 23, 2009 01:15:43 pm Phil Longstaff wrote: > On February 23, 2009 04:35:48 am Roland Illig wrote: > > Phil Longstaff schrieb: > > > Is there any way of indicating to splint that if a struct with pointers > > > is malloc'ed and the pointers are given values, that the previous > > > values don't need to be freed because it is new memory? > > > > > > Example: > > > > > > typedef struct { > > > > > > char* x; > > > > > > } struct_t; > > > > > > struct_t* s = malloc( sizeof(struct_t) ); > > > > > > s.x = malloc(10); > > > > > > will give a warning that s.x is implied only and hasn't been freed, > > > leading to memory leak. However, since s is pointing to new storage, > > > there isn't anything to be freed. > > > > The warning wants to tell you that you need to free s->x (not s.x) > > later. This works for me: > > > > #include > > #include > > > > typedef struct { > > char* x; > > } struct_t; > > > > int main(void) > > { > > struct_t* s; > > > > s = malloc( sizeof(struct_t) ); > > assert(s != NULL); > > s->x = malloc(10); > > > > /* ... */ > > > > free(s->x); > > free(s); > > > > return 0; > > } > > Yes, I meant s->x not s.x. I find that I'm asking the wrong question. > > s = malloc(sizeof(struct_t)) > s->x = ... > > produces no warnings, whereas > > s = g_malloc(sizeof(struct_t)) > s->x = ... > > produces the warning that implicitly only storage s->x is not freed before > the assignment. g_malloc() is the version of malloc included in glib on > linux (library.gnome.org/devel/glib/). Maybe splint knows about malloc and > that it always returns fresh storage. Is there any way to tell it that > g_malloc also returns fresh storage (the same way I can use -booltype to > tell it that gboolean is a boolean type)? > > Phil I may have an answer. I downloaded the source and looked at the standard library definition and found the /*@out@*/ annotation. Phil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090223/ae3170ca/attachment-0001.html From plongstaff at rogers.com Mon Feb 23 10:15:43 2009 From: plongstaff at rogers.com (Phil Longstaff) Date: Mon, 23 Feb 2009 13:15:43 -0500 Subject: [splint-discuss] Splint and malloc In-Reply-To: <49A26DF4.2050005@gmx.de> References: <200902221951.54430.plongstaff@rogers.com> <49A26DF4.2050005@gmx.de> Message-ID: <200902231315.44036.plongstaff@rogers.com> On February 23, 2009 04:35:48 am Roland Illig wrote: > Phil Longstaff schrieb: > > Is there any way of indicating to splint that if a struct with pointers > > is malloc'ed and the pointers are given values, that the previous values > > don't need to be freed because it is new memory? > > > > Example: > > > > typedef struct { > > > > char* x; > > > > } struct_t; > > > > struct_t* s = malloc( sizeof(struct_t) ); > > > > s.x = malloc(10); > > > > will give a warning that s.x is implied only and hasn't been freed, > > leading to memory leak. However, since s is pointing to new storage, > > there isn't anything to be freed. > > The warning wants to tell you that you need to free s->x (not s.x) > later. This works for me: > > #include > #include > > typedef struct { > char* x; > } struct_t; > > int main(void) > { > struct_t* s; > > s = malloc( sizeof(struct_t) ); > assert(s != NULL); > s->x = malloc(10); > > /* ... */ > > free(s->x); > free(s); > > return 0; > } Yes, I meant s->x not s.x. I find that I'm asking the wrong question. s = malloc(sizeof(struct_t)) s->x = ... produces no warnings, whereas s = g_malloc(sizeof(struct_t)) s->x = ... produces the warning that implicitly only storage s->x is not freed before the assignment. g_malloc() is the version of malloc included in glib on linux (library.gnome.org/devel/glib/). Maybe splint knows about malloc and that it always returns fresh storage. Is there any way to tell it that g_malloc also returns fresh storage (the same way I can use -booltype to tell it that gboolean is a boolean type)? Phil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090223/e5fdf859/attachment-0002.html From Forrest.Sun at med.ge.com Mon Feb 23 12:03:10 2009 From: Forrest.Sun at med.ge.com (Sun, Forrest (GE Healthcare)) Date: Mon, 23 Feb 2009 15:03:10 -0500 Subject: [splint-discuss] install splint In-Reply-To: References: Message-ID: <8BC7D3BD84751245B2EF0731B37F02F203E8E0A6@ALPMLVEM07.e2k.ad.ge.com> Changing "__pid_t" to "pid_t" seemed to resolve the compile problem I had. Got splint built successfully. Thanks, Forrest -----Original Message----- Message: 1 Date: Mon, 16 Feb 2009 17:40:18 -0500 From: Bill Pringlemeir Subject: Re: [splint-discuss] install splint To: Discussions about the Splint annotation-assisted static analysis project Cc: splint-discuss at mail.cs.virginia.edu Message-ID: <87hc2uypil.fsf at sympatico.ca> Content-Type: text/plain; charset=us-ascii On 11 Feb 2009, Forrest.Sun at med.ge.com wrote: > Has anyone encountered the following error during installation splint > 3.2.1? [snip] > osd.c: In function `osd_getPid': > osd.c:519: error: `__pid_t' undeclared (first use in this function) A search on 'splint pid_t' or 'splint __pid_t' might help. That might [eventually] take you here, http://www.cs.virginia.edu/pipermail/splint-discuss/2008-August/001207.h tml I think it was fixed in CVS? 'pid_t' is the better variant to use. It looks like your platform(s) has the same problem as the Mac poster? Can you try with the CVS version (which is composed only of bug fixes and no new feature (with additional bugs)). fwiw, Bill Pringlemeir. -- Some people are alive because it's against the law to kill them. From gb0108 at gmx.de Thu Feb 26 11:31:13 2009 From: gb0108 at gmx.de (Georg Brutscheid) Date: Thu, 26 Feb 2009 20:31:13 +0100 Subject: [splint-discuss] question about splinrc Message-ID: <20090226193113.104630@gmx.net> Hi All, I am new to splint and I am trying to put some initialisation the .splintrc file instead of calling from command line. Unfortunatly adding the flags on command line works fine but if I add the flags to the .splintrc > What I did: $ splint -weak example.c Splint 3.1.1 --- 09 Aug 2007 example.c:61: Include file matches the name of a POSIX library, but the POSIX library is not being used. Consider using +posixlib or +posixstrictlib to select the POSIX library, or -warnposix to suppress this message. Header name matches a POSIX header, but the POSIX library is not selected. (Use -warnposixheaders to inhibit warning) > Now, if I add "+posixlib" as requested and the include directory for the Parse Error, it works fine. $ splint +posixlib -I../include -weak example.c > But if I add the command line flags into the .splintrc, I get a warning +posixlib -I. -I/cygdrive/d/Projekte/include -preproc -Dcyg_uint8=char - ... $ splint -weak example.c Splint 3.1.1 --- 09 Aug 2007 /home/Georg/.splintrc:15:22: Unrecognized option: +posixlib A flag is not recognized or used in an incorrect way (Use -badflag to inhibit warning) Can anyone tell me why the flag "+posixlib" doesn't work with the .splintrc file? Thanks Georg -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01