From lapem at excite.com Sat May 7 11:04:36 2011 From: lapem at excite.com (Lapem) Date: Sat, 07 May 2011 11:04:36 -0400 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? Message-ID: <20110507110436.15223@web009.roc2.bluetie.com> SPLINT is such a versatile tool, there must be a way to do this. At work I use Dynamic C, a variant of ANSI C used on Rabbit brand microprocessors. One of the peculiarities of Dynamic C is that it uses the pre- compiler directive #use instead of #include to pull source code into a C file. The files pulled in are named *.LIB instead of *.h, but that should be transparent to Splint. Is there a way to make Splint treat #use like #include? Because #use is nested, ie: each file included via #use is likely to have its own instances of #use statements, this needs to be a global substitution. My first thought was to insert "#define #use #include" in a Splint option file or the S_SPLINT_S section for Splint directives. That does not work. Is there a way to specify an option in Splint that would make this portion of Dynamic C more like ANSI C without ? Any help would be appreciated. From splint at sympatico.ca Sat May 7 13:13:05 2011 From: splint at sympatico.ca (Bill Pringlemeir) Date: Sat, 7 May 2011 13:13:05 -0400 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? In-Reply-To: <20110507110436.15223@web009.roc2.bluetie.com> (lapem@excite.com's message of "Sat, 07 May 2011 11:04:36 -0400") References: <20110507110436.15223@web009.roc2.bluetie.com> Message-ID: On 7 May 2011, lapem at excite.com wrote: > My first thought was to insert "#define #use #include" in a Splint > option file or the S_SPLINT_S section for Splint directives. That does > not work. > Is there a way to specify an option in Splint that would make this > portion of Dynamic C more like ANSI C without ? I don't think you will be able to do this with splint alone. There are two phases of splint processing. One preprocess and the second parses 'c'. There are somewhat intermixed. It looks like you want to change the grammar of the c pre-processor. However, it should be fairly simple to run your source through sed/awk/perl and do the transformation as you intended with the macro. I think this is the best approach. fwiw, Bill Pringlemeir. -- Yow! Legally-imposed CULTURE-reduction is CABBAGE-BRAINED! From margiodo at gmail.com Sun May 8 02:09:37 2011 From: margiodo at gmail.com (domenico margiotta) Date: Sun, 8 May 2011 08:09:37 +0200 Subject: [splint-discuss] (no subject) In-Reply-To: References: Message-ID: Mi scuso per l'email con link strano e senza oggetto.purtroppo mi hanno rubato la password e qualcuno ha utilizzato la mia mail per inviare mail dannose. Sorry to everyone but someone has violated my account And used it TO send a maleware mail. Il giorno domenica 8 maggio 2011, domenico margiotta ha scritto: > http://helpasp.net/wp-content/themes/twentyten/mylife.html > From lapem at excite.com Sun May 8 06:37:12 2011 From: lapem at excite.com (Lapem) Date: Sun, 08 May 2011 06:37:12 -0400 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? Message-ID: <20110508063712.11622@web013.roc2.bluetie.com> Bill: Thanks for the prompt reply. I'm glad to get a clear answer on splint's capabilities. I thought of copying each *.LIB file to a of the same name with a *.h extension, then substituting #include for each occurrence of #use in both the master C source file and in each new *.h file, at the same time including the equivalent *.h file instead of the old *.LIB file. This would be workable if the number of *.LIB files were limited to source files in my project. Unfortunately, Dynamic C uses the *.LIB approach because it has no linker. The vast majority of nested *.LIB files comprise the various function libraries provided with the Dynamic C compiler. Each *.LIB file contains both the API information normally contained in a *.h file, and the source code for that library. To repeat the file copy and sed/awk/perl operation for the entire Dynamic C library suite would be a somewhat daunting undertaking. I'm not sure I want to go that far to get the benefits that running Splint on my project would provide. The idea of a virtual substitution being done within Splint as it ran was much more appealing, and would not have been intrusive on the Dynamic C function library. Thanks again for being so responsive. Best regards, Tom Cox -----Original Message----- From: "Bill Pringlemeir" [splint at sympatico.ca] Date: 05/07/2011 01:16 PM To: splint-discuss at mail.cs.virginia.edu Subject: Re: [splint-discuss] Is it possible to substitute pre-compiler directives? Note: Original message sent as attachment -------------- next part -------------- An embedded message was scrubbed... From: Bill Pringlemeir Subject: Re: [splint-discuss] Is it possible to substitute pre-compiler directives? Date: Sat, 7 May 2011 13:13:05 -0400 Size: 4624 Url: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20110508/7dd07fe2/attachment.mht From lapem at excite.com Sun May 8 06:37:12 2011 From: lapem at excite.com (Lapem) Date: Sun, 08 May 2011 06:37:12 -0400 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? Message-ID: <20110508063712.11622@web013.roc2.bluetie.com> Bill: Thanks for the prompt reply. I'm glad to get a clear answer on splint's capabilities. I thought of copying each *.LIB file to a of the same name with a *.h extension, then substituting #include for each occurrence of #use in both the master C source file and in each new *.h file, at the same time including the equivalent *.h file instead of the old *.LIB file. This would be workable if the number of *.LIB files were limited to source files in my project. Unfortunately, Dynamic C uses the *.LIB approach because it has no linker. The vast majority of nested *.LIB files comprise the various function libraries provided with the Dynamic C compiler. Each *.LIB file contains both the API information normally contained in a *.h file, and the source code for that library. To repeat the file copy and sed/awk/perl operation for the entire Dynamic C library suite would be a somewhat daunting undertaking. I'm not sure I want to go that far to get the benefits that running Splint on my project would provide. The idea of a virtual substitution being done within Splint as it ran was much more appealing, and would not have been intrusive on the Dynamic C function library. Thanks again for being so responsive. Best regards, Tom Cox -----Original Message----- From: "Bill Pringlemeir" [splint at sympatico.ca] Date: 05/07/2011 01:16 PM To: splint-discuss at mail.cs.virginia.edu Subject: Re: [splint-discuss] Is it possible to substitute pre-compiler directives? Note: Original message sent as attachment -------------- next part -------------- An embedded message was scrubbed... From: Bill Pringlemeir Subject: Re: [splint-discuss] Is it possible to substitute pre-compiler directives? Date: Sat, 7 May 2011 13:13:05 -0400 Size: 4624 Url: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20110508/7dd07fe2/attachment-0001.mht From splint at sympatico.ca Sun May 8 19:03:23 2011 From: splint at sympatico.ca (Bill Pringlemeir) Date: Sun, 8 May 2011 19:03:23 -0400 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? In-Reply-To: <20110508063712.11622@web013.roc2.bluetie.com> (lapem@excite.com's message of "Sun, 08 May 2011 06:37:12 -0400") References: <20110508063712.11622@web013.roc2.bluetie.com> Message-ID: On 8 May 2011, lapem at excite.com wrote: > Unfortunately, Dynamic C uses the *.LIB approach because it has no > linker. The vast majority of nested *.LIB files comprise the various > function libraries provided with the Dynamic C compiler. If this is the case, then it seems difficult to use splint with Dynamic C. Generally splint doesn't have to parse standard library headers. It uses a 'pre-parsed' annotated version. Ie, a 'C' library version of strcpy() will not have the same amount of information as the splint annotated headers. So any person parsing dynamic 'C' with splint would need annotated headers of the the 'function libraries'. Without the annotations, splint is not much better than increasing your compiler warning levels. So even if your '#define #use ...' could work you really wouldn't be much ahead imho. Fwiw, Bill Pringlemeir. -- Programming is like sex. One mistake and you have to support it for the rest of your life. - Michael Sinz From ok at cs.otago.ac.nz Mon May 9 00:39:24 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Mon, 9 May 2011 16:39:24 +1200 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? In-Reply-To: References: <20110507110436.15223@web009.roc2.bluetie.com> Message-ID: <8913A403-A620-42BB-BA1C-A9D3BA9D5280@cs.otago.ac.nz> splint is an open source program. Try this. (1) Download the sources. (2) Make this one-line change to cpplib.c m% diff -c cpplib.c.bak cpplib.c *** cpplib.c.bak 2011-05-09 16:37:16.000000000 +1200 --- cpplib.c 2011-05-09 16:37:39.000000000 +1200 *************** *** 511,516 **** --- 511,517 ---- { 5, do_xifdef, "ifdef", T_IFDEF, TRUE, FALSE, FALSE }, { 6, do_xifdef, "ifndef", T_IFNDEF, TRUE, FALSE, FALSE }, { 7, do_include, "include", T_INCLUDE, TRUE, FALSE, FALSE }, + { 3, do_include, "use", T_INCLUDE, TRUE, FALSE, FALSE }, /*Dynamic C*/ { 5, do_endif, "endif", T_ENDIF, TRUE, FALSE, FALSE }, { 4, do_else, "else", T_ELSE, TRUE, FALSE, FALSE }, { 2, do_if, "if", T_IF, TRUE, FALSE, FALSE }, (3) Build in the usual fashion. I HAVE NOT TESTED THIS, but I _think_ it should make #use act exactly the same as #include. From ok at cs.otago.ac.nz Mon May 9 01:36:53 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Mon, 9 May 2011 17:36:53 +1200 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? In-Reply-To: <8913A403-A620-42BB-BA1C-A9D3BA9D5280@cs.otago.ac.nz> References: <20110507110436.15223@web009.roc2.bluetie.com> <8913A403-A620-42BB-BA1C-A9D3BA9D5280@cs.otago.ac.nz> Message-ID: <7FC7C507-A091-4C4E-B0CA-742AACB395B7@cs.otago.ac.nz> On 9/05/2011, at 4:39 PM, Richard O'Keefe wrote: > > I HAVE NOT TESTED THIS, but I _think_ it should make #use act > exactly the same as #include. Ah. Having read more, I see that "exactly the same as #include" is not what you actually want. It sounds rather like the Turbo Pascal model of modules. That would require rather more extensive changes to splint. From Wenzel at bbr-vt.de Mon May 9 02:02:14 2011 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Mon, 9 May 2011 08:02:14 +0200 Subject: [splint-discuss] Is it possible to substitute pre-compilerdirectives? In-Reply-To: <7FC7C507-A091-4C4E-B0CA-742AACB395B7@cs.otago.ac.nz> References: <20110507110436.15223@web009.roc2.bluetie.com><8913A403-A620-42BB-BA1C-A9D3BA9D5280@cs.otago.ac.nz> <7FC7C507-A091-4C4E-B0CA-742AACB395B7@cs.otago.ac.nz> Message-ID: <46B6459B655D7342AB97371E8B7CD8B8015FC479@sv-exch.BBR.local> Well, perhaps "exactly" is not the goal, but "nearly". It might work if an annotated library file is created that contains the used parts of Dynamic C's library information. For future projets it might be wise to declare all of them. As I understand chapter 14 of the manual, this file is a "standard" header file with some necessary Splint annotations, if any. This file can be processed once to generate an .lcd file which can be used for checking multiple projects. After patching Splint to accept #use just like #include, it can be called with the option to ignore all system-includes and the option to load the .lcd file. At least this is an idea I would try. Another idea ist to write a standard header file that defines the used library interface in standard C. Now the project's sources just have to be edited to #use ... when compiling and to #include ... when being Splinted: #if defined (S_SPLINT_S) #include "dynamic_c.h" #else #use #endif Cheers, Bodo -- B0D0 - Real programmers do it in hex. From ok at cs.otago.ac.nz Mon May 9 00:39:24 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Mon, 9 May 2011 16:39:24 +1200 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? In-Reply-To: References: <20110507110436.15223@web009.roc2.bluetie.com> Message-ID: <8913A403-A620-42BB-BA1C-A9D3BA9D5280@cs.otago.ac.nz> splint is an open source program. Try this. (1) Download the sources. (2) Make this one-line change to cpplib.c m% diff -c cpplib.c.bak cpplib.c *** cpplib.c.bak 2011-05-09 16:37:16.000000000 +1200 --- cpplib.c 2011-05-09 16:37:39.000000000 +1200 *************** *** 511,516 **** --- 511,517 ---- { 5, do_xifdef, "ifdef", T_IFDEF, TRUE, FALSE, FALSE }, { 6, do_xifdef, "ifndef", T_IFNDEF, TRUE, FALSE, FALSE }, { 7, do_include, "include", T_INCLUDE, TRUE, FALSE, FALSE }, + { 3, do_include, "use", T_INCLUDE, TRUE, FALSE, FALSE }, /*Dynamic C*/ { 5, do_endif, "endif", T_ENDIF, TRUE, FALSE, FALSE }, { 4, do_else, "else", T_ELSE, TRUE, FALSE, FALSE }, { 2, do_if, "if", T_IF, TRUE, FALSE, FALSE }, (3) Build in the usual fashion. I HAVE NOT TESTED THIS, but I _think_ it should make #use act exactly the same as #include. From ok at cs.otago.ac.nz Mon May 9 01:36:53 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Mon, 9 May 2011 17:36:53 +1200 Subject: [splint-discuss] Is it possible to substitute pre-compiler directives? In-Reply-To: <8913A403-A620-42BB-BA1C-A9D3BA9D5280@cs.otago.ac.nz> References: <20110507110436.15223@web009.roc2.bluetie.com> <8913A403-A620-42BB-BA1C-A9D3BA9D5280@cs.otago.ac.nz> Message-ID: <7FC7C507-A091-4C4E-B0CA-742AACB395B7@cs.otago.ac.nz> On 9/05/2011, at 4:39 PM, Richard O'Keefe wrote: > > I HAVE NOT TESTED THIS, but I _think_ it should make #use act > exactly the same as #include. Ah. Having read more, I see that "exactly the same as #include" is not what you actually want. It sounds rather like the Turbo Pascal model of modules. That would require rather more extensive changes to splint. From steve_geo at optusnet.com.au Wed May 18 01:57:58 2011 From: steve_geo at optusnet.com.au (Stephen George) Date: Wed, 18 May 2011 15:57:58 +1000 Subject: [splint-discuss] Defining local variables AFTER some lines of code Message-ID: <4DD35FE6.4050308@optusnet.com.au> I have a project (existing code base) where in a number of places the local variables are NOT defined first lines in a function, but after some lines of code, gnu c seems to handle this situation fine. Splint chokes on it with a parseerror, I have been looking at splints flag's but I cannot seem to change this behaviour. Have I overlooked something, or am I trying to achieve something that is not possible with splint? (Changing code to suit splint is not an option here) example code. static void StateAccyDacCalibHigh() { DBG("\n"); DacVoltagePosActual[AnalogOutput_AnOut_A] = AnaTskData.voltage.channel[AnalogInput_AOUT_A]; DacVoltagePosActual[AnalogOutput_AnOut_B] = AnaTskData.voltage.channel[AnalogInput_AOUT_B]; uint i; << SPLINT chokes here for (i=0; i References: <4DD35FE6.4050308@optusnet.com.au> Message-ID: <46B6459B655D7342AB97371E8B7CD8B80164B60E@sv-exch.BBR.local> > (Changing code to suit splint is not an option here) Oh, sorry. Answering quickly made be choke. ;-) From Wenzel at bbr-vt.de Wed May 18 02:15:37 2011 From: Wenzel at bbr-vt.de (Wenzel, Bodo) Date: Wed, 18 May 2011 08:15:37 +0200 Subject: [splint-discuss] Defining local variables AFTER some lines of code In-Reply-To: <4DD35FE6.4050308@optusnet.com.au> References: <4DD35FE6.4050308@optusnet.com.au> Message-ID: <46B6459B655D7342AB97371E8B7CD8B80164B60C@sv-exch.BBR.local> Well, Splint don't know all of the C99 extensions. And declaring variables in the middle is one of those. If you can change the source code of your project you could add a level of braces like this: static void StateAccyDacCalibHigh() { DBG("\n"); DacVoltagePosActual[AnalogOutput_AnOut_A] = AnaTskData.voltage.channel[AnalogInput_AOUT_A]; DacVoltagePosActual[AnalogOutput_AnOut_B] = AnaTskData.voltage.channel[AnalogInput_AOUT_B]; { /* This is added. */ uint i; for (i=0; i (Stephen George's message of "Wed, 18 May 2011 15:57:58 +1000") References: <4DD35FE6.4050308@optusnet.com.au> Message-ID: On 18 May 2011, steve_geo at optusnet.com.au wrote: > I have a project (existing code base) where in a number of places the > local variables are NOT defined first lines in a function, but after > some lines of code, gnu c seems to handle this situation fine. > AnaTskData.voltage.channel[AnalogInput_AOUT_B]; > uint i; << SPLINT chokes here > for (i=0; i References: <4DD35FE6.4050308@optusnet.com.au> Message-ID: <4DD5C7EC.5070604@optusnet.com.au> On 19/05/2011 11:01 PM, Bill Pringlemeir wrote: > On 18 May 2011, steve_geo at optusnet.com.au wrote: >> I have a project (existing code base) where in a number of places the >> local variables are NOT defined first lines in a function, but after >> some lines of code, gnu c seems to handle this situation fine. >> AnaTskData.voltage.channel[AnalogInput_AOUT_B]; >> uint i;<< SPLINT chokes here >> for (i=0; i Can you try the cvs version? I put patches in from Jake Holland and > Chih-Hung Hsieh related to C99 support. > > cvs -d:pserver:anonymous at splint.cvs.sourceforge.net:/cvsroot/splint login > cvs -z3 -d:pserver:anonymous at splint.cvs.sourceforge.net:/cvsroot/splint co -P splint > > hth, > Bill Pringlemeir. Thanks Bill, I've pull down the source, and would like to test, but is there any instructions for building under windows, couldn't find much on web site except to say windows users are on their own. Should I be using linux and cross compiling to build the windows version? I notice there was a MS Vis Studio .sln file in the src tree. I tried that and after fixing a few path issues it seems to be bombing out as cannot find flag_codes.gen flag_codes.h(22): fatal error C1083: Cannot open include file: 'flag_codes.gen': No such file or directory My guess is that it's a generated file that the sln has not generated. Any hints what command line generates the flag_code.gen? I guess someone knows how to build a windows version since there is a windows installer available on the download page :-) Thanks for any info you can provide. Steve From ok at cs.otago.ac.nz Thu May 19 22:54:39 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Fri, 20 May 2011 14:54:39 +1200 Subject: [splint-discuss] Defining local variables AFTER some lines of code In-Reply-To: <22747_1305698942_p4I6905d025095_4DD35FE6.4050308@optusnet.com.au> References: <22747_1305698942_p4I6905d025095_4DD35FE6.4050308@optusnet.com.au> Message-ID: On 18/05/2011, at 5:57 PM, Stephen George wrote: > I have a project (existing code base) where in a number of places the > local variables are NOT defined first lines in a function, but after > some lines of code, gnu c seems to handle this situation fine. That is C99, not C89. gcc will NOT accept it if you say -std=c89. > > Splint chokes on it with a parseerror, I have been looking at splints > flag's but I cannot seem to change this behaviour. Have I overlooked > something, or am I trying to achieve something that is not possible with > splint? The transformation from { } to { { } } is fairly straightforward. In fact, I thought somebody was going to add support for this to splint. > > (Changing code to suit splint is not an option here) Why not? The change is just adding a couple of curly braces, and it _should_ have no effect on the code is generated, and it will not make the code unacceptable to any C compiler. From ok at cs.otago.ac.nz Thu May 19 22:54:39 2011 From: ok at cs.otago.ac.nz (Richard O'Keefe) Date: Fri, 20 May 2011 14:54:39 +1200 Subject: [splint-discuss] Defining local variables AFTER some lines of code In-Reply-To: <22747_1305698942_p4I6905d025095_4DD35FE6.4050308@optusnet.com.au> References: <22747_1305698942_p4I6905d025095_4DD35FE6.4050308@optusnet.com.au> Message-ID: On 18/05/2011, at 5:57 PM, Stephen George wrote: > I have a project (existing code base) where in a number of places the > local variables are NOT defined first lines in a function, but after > some lines of code, gnu c seems to handle this situation fine. That is C99, not C89. gcc will NOT accept it if you say -std=c89. > > Splint chokes on it with a parseerror, I have been looking at splints > flag's but I cannot seem to change this behaviour. Have I overlooked > something, or am I trying to achieve something that is not possible with > splint? The transformation from { } to { { } } is fairly straightforward. In fact, I thought somebody was going to add support for this to splint. > > (Changing code to suit splint is not an option here) Why not? The change is just adding a couple of curly braces, and it _should_ have no effect on the code is generated, and it will not make the code unacceptable to any C compiler. From cwr at netcom.co.uk Fri May 20 12:35:59 2011 From: cwr at netcom.co.uk (cwr at netcom.co.uk) Date: Fri, 20 May 2011 17:35:59 +0100 Subject: [splint-discuss] splint PC_MAX_CANON bug on Linux/Gnome Message-ID: <20110520173559.51772y3guhi7792c@webmail.netcom.co.uk> Does anyone have a work-around for the PC_MAX_CANON bug, which is still present in both splint 3.1.2 and the current CVS version? In the sourceforge records it's noted as "fixed" (bug number 1930523) but in fact the tracker entry just timed out. The bug's been around since early 2008, so I don't expect a fix, but I'd really like to know if there's a standard work-around. I can't really use splint with Linux/Gnome without one. (FWIW splint blows up on line 31 of /usr/include/bits/confname.h with the message "Internal Bug at cscannerHelp.c:2428, Unexpanded macro not function or constant: int _PC_MAX_CANON [errno: 0]). Thanks - Will From bberryusa at gmail.com Mon May 23 06:48:31 2011 From: bberryusa at gmail.com (Bo Berry) Date: Mon, 23 May 2011 06:48:31 -0400 Subject: [splint-discuss] splint search path Message-ID: Splint-discussion: Recently installed splint on a Mac from source code. The build, install was fine, no errors or problems. When I run splint it fails due to search path. The LARCH_PATH and LCLIMPORTDIR are set. Scanned the splint web pages but did not find answers. What documentation am I missing to set splint's search path? Thanks in advance -Bo client.c:24:25: Cannot find include file libxml/tree.h on search path: /usr/include;/usr/local/include Preprocessing error. (Use -preproc to inhibit warning) client.c:25:26: Cannot find include file libxml/xpath.h on search path: /usr/include;/usr/local/include client.c:26:27: Cannot find include file libxml/parser.h on search path: /usr/include;/usr/local/include -- Notice: The information contained in this message may be privileged and confidential and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to the message and then securely deleting it and any attachments from your computer. Thank you. From splint at sympatico.ca Tue May 24 20:57:37 2011 From: splint at sympatico.ca (Bill Pringlemeir) Date: Tue, 24 May 2011 20:57:37 -0400 Subject: [splint-discuss] splint search path In-Reply-To: (Bo Berry's message of "Mon, 23 May 2011 06:48:31 -0400") References: Message-ID: On 23 May 2011, bberryusa at gmail.com wrote: > Scanned the splint web pages but did not find answers. What > documentation am I missing to set > splint's search path? http://www.splint.org/manual/html/appB.html Search for 'Initialization'. You can download the PDF version. Most of the 'getting started' stuff is actually in the appendix. This is because the most useful part of splint is annotations. However, most people just want splint to parse their source, which really doesn't achieve too much, but might be a good first step. Fwiw, Bill Pringlemeir. -- The birds of leaving call to us. Yet here we stand endowed with the fear of flight. - Dead can Dance From splint at sympatico.ca Tue May 24 21:03:11 2011 From: splint at sympatico.ca (Bill Pringlemeir) Date: Tue, 24 May 2011 21:03:11 -0400 Subject: [splint-discuss] Defining local variables AFTER some lines of code In-Reply-To: <4DD5C7EC.5070604@optusnet.com.au> (Stephen George's message of "Fri, 20 May 2011 11:46:20 +1000") References: <4DD35FE6.4050308@optusnet.com.au> <4DD5C7EC.5070604@optusnet.com.au> Message-ID: On 19 May 2011, steve_geo at optusnet.com.au wrote: > My guess is that it's a generated file that the sln has not generated. > Any hints what command line generates the flag_code.gen? > I guess someone knows how to build a windows version since there is a > windows installer available on the download page :-) I haven't used Windows in a very long time. However, the file is generated by 'grep "FLG_" flags.def > Headers/flag_codes.gen'. You can maybe use 'findstr' if you don't have grep. Maybe someone else uses Windows? hth, Bill Pringlemeir. -- Yow! Legally-imposed CULTURE-reduction is CABBAGE-BRAINED! From splint at sympatico.ca Tue May 24 21:17:15 2011 From: splint at sympatico.ca (Bill Pringlemeir) Date: Tue, 24 May 2011 21:17:15 -0400 Subject: [splint-discuss] splint PC_MAX_CANON bug on Linux/Gnome In-Reply-To: <20110520173559.51772y3guhi7792c@webmail.netcom.co.uk> (cwr@netcom.co.uk's message of "Fri, 20 May 2011 17:35:59 +0100") References: <20110520173559.51772y3guhi7792c@webmail.netcom.co.uk> Message-ID: On 20 May 2011, cwr at netcom.co.uk wrote: > Does anyone have a work-around for the PC_MAX_CANON bug, > which is still present in both splint 3.1.2 and the current > CVS version? In the sourceforge records it's noted as > "fixed" (bug number 1930523) but in fact the tracker entry > just timed out. > > The bug's been around since early 2008, so I don't expect > a fix, but I'd really like to know if there's a standard > work-around. I can't really use splint with Linux/Gnome > without one. > > (FWIW splint blows up on line 31 of /usr/include/bits/confname.h > with the message "Internal Bug at cscannerHelp.c:2428, Unexpanded > macro not function or constant: int _PC_MAX_CANON [errno: 0]). I spent some time on it and it doesn't reproduce for me. You need to say what version of 'confname.h' you have. It is from some glibc version. As well, the splint command options are useful. Try to get a minimum file with '+nof'. I was unable to reproduce this (parse error) on my Debian squeeze with various splint commands. The default splint libraries that came with Debian may be messed up or maybe there is some cross build/platform issue with lcd files that breaks packaging. bpringle at pvr:/home/src/splint.HEAD/lib$ locate posix.lcd /home/src/splint.HEAD/lib/posix.lcd /usr/share/splint/lib/posix.lcd bpringle at pvr:/home/src/splint.HEAD/src$ ./splint +nof a.c Splint 3.1.2 --- 14 Nov 2010 a.c:1: 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) Finished checking --- 1 code warning bpringle at pvr:/home/src/splint.HEAD/src$ ./splint +nof +posixlib a.c Splint 3.1.2 --- 14 Nov 2010 Finished checking --- no warnings bpringle at pvr:/home/src/splint.HEAD/src$ cat a.c #include int main() { return 0; } -- I work hard because millions on welfare depend on me. From Michael.Wojcik at microfocus.com Wed May 25 08:39:04 2011 From: Michael.Wojcik at microfocus.com (Michael Wojcik) Date: Wed, 25 May 2011 07:39:04 -0500 Subject: [splint-discuss] Defining local variables AFTER some lines ofcode In-Reply-To: References: <4DD35FE6.4050308@optusnet.com.au><4DD5C7EC.5070604@optusnet.com.au> Message-ID: <0AB4526732901E45B9B3A55FFD725D6714C6D1@AUS-EXCHANGE.microfocus.com> > From: splint-discuss-bounces at cs.virginia.edu [mailto:splint-discuss- > bounces at cs.virginia.edu] On Behalf Of Bill Pringlemeir > Sent: Tuesday, 24 May, 2011 21:03 > To: splint-discuss at mail.cs.virginia.edu > Subject: Re: [splint-discuss] Defining local variables AFTER some lines > ofcode > > > On 19 May 2011, steve_geo at optusnet.com.au wrote: > > > My guess is that it's a generated file that the sln has not > > generated. > > Any hints what command line generates the flag_code.gen? > > I haven't used Windows in a very long time. However, the file is > generated by 'grep "FLG_" flags.def > Headers/flag_codes.gen'. You can > maybe use 'findstr' if you don't have grep. > > Maybe someone else uses Windows? I do, but I haven't built Splint from source in a very long time. There are several grep implementations available for Windows. While findstr would work in that case, I'd suggest installing MSYS, MinGW, or Cygwin; they're all free, and they provide a variety of useful tools besides grep. -- Michael Wojcik Principal Software Systems Developer, Micro Focus This message has been scanned by MailController - portal1.mailcontroller.co.uk From banks-michael at zai.com Wed May 25 18:01:42 2011 From: banks-michael at zai.com (Banks, Michael) Date: Wed, 25 May 2011 18:01:42 -0400 Subject: [splint-discuss] Odd if/then block behavior Message-ID: <8341D66CE19FA347AA897AEC0755E8370111137F@swan.rivers.zai.com> Hello; I'm working on getting to know how to effectively use Splint on my code. I'm still getting up to speed, but I did find one thing that I think may be a bug, and wanted to bring it up. I've tried to make a minimal code sample that exhibits this behavior. I'll append it below. Many thanks for any pointers. I have a few other strange behaviors I'm seeing, but those I'm still running to ground to make sure it isn't just my lack of understanding of Splint's memory model. Thanks, Michael Banks /* Illustration of odd behavior in Splint 3.1.2 */ /* Run: splint -fcnuse file.c */ typedef struct a_st { /*@null@*/ unsigned char *b; size_t blen; } ast; /* This function emits no warnings; good... */ static void resize_good(/*@null@*/ ast *a, size_t newlen) { if (!a) return; /* nothing to do */ if (!a->b) return; /* no work space */ if (newlen > a->blen) { /* must expand space */ a->b = realloc(a->b,newlen); } else { if (newlen==0) { /* asked for 0, we shall eliminate it */ free(a->b); a->b = NULL; } } a->blen = newlen; } /* This one, however, gives two warnings. */ /* All that has changed is the braces; why does this do this? */ static void resize_bad(/*@null@*/ ast *a, size_t newlen) { if (!a) return; /* nothing to do */ if (!a->b) return; /* no work space */ if (newlen > a->blen) /* must expand space */ a->b = realloc(a->b,newlen); else { if (newlen==0) { /* asked for 0, we shall eliminate it */ free(a->b); a->b = NULL; } } a->blen = newlen; } From cwr at netcom.co.uk Thu May 26 03:29:34 2011 From: cwr at netcom.co.uk (cwr at netcom.co.uk) Date: Thu, 26 May 2011 08:29:34 +0100 Subject: [splint-discuss] splint PC_MAX_CANON bug on Linux/Gnome In-Reply-To: References: <20110520173559.51772y3guhi7792c@webmail.netcom.co.uk> Message-ID: <20110526082934.432743hvwkimvja6@webmail.netcom.co.uk> Quoting Bill Pringlemeir : > I spent some time on it and it doesn't reproduce for me. You need to > say what version of 'confname.h' you have. It is from some glibc > version. As well, the splint command options are useful. Try to get a > minimum file with '+nof'. > > I was unable to reproduce this (parse error) on my Debian squeeze with > various splint commands. The default splint libraries that came with > Debian may be messed up or maybe there is some cross build/platform > issue with lcd files that breaks packaging. > Thanks for the cross-check; I've tried again, with Splint 3.1.2, and the failure has nothing to do with Gnome. It's triggered by unistd.h, and there's a workaround. I ran the command: splint -weak +posixlib b.c with the file: /* ** b.c - test of splint */ #include #include #include #include #include #include #include #include int main(void) { printf("Testing splint\n"); return 0; } and got the error message: cwr at farthing battery $ ./newlint.sh Splint 3.1.2 --- 20 May 2011 /usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428: Unexpanded macro not function or constant: int _PC_MAX_CANON [errno: 0] *** Please report bug to splint-bug at splint.org *** (attempting to continue, results may be incorrect) /usr/include/bits/confname.h:32:1: Parse Error: Non-function declaration: _PC_MAX_CANON : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. cwr at farthing battery $ That was on Gnome 2.28, with the confname.h file: -rw-r--r-- 1 bin bin 23717 2010-01-26 17:50 confname.h 91624536140b18afff012c670f26cb14 confname.h and the libraries: dev-libs/glib-2.22.4 sys-libs/glibc-2.10.1-r1 There was a similar failure on Gnome 2.32, with confname.h and libraries: dev-libs/glib-2.28.6 sys-libs/glibc-2.11.3 -rw-r--r-- 1 bin bin 23716 May 3 18:47 confname.h 00e4d78a4236b62956d1d1a5558fdcbd confname.h The work-around is to replace +posixlib (which splint recommends) with -warnposixheaders; but I don't know what other warnings that conceals. Will From Forrest.Sun at med.ge.com Tue May 31 16:37:50 2011 From: Forrest.Sun at med.ge.com (Sun, Forrest (GE Healthcare)) Date: Tue, 31 May 2011 16:37:50 -0400 Subject: [splint-discuss] static analysis tool Message-ID: <8BC7D3BD84751245B2EF0731B37F02F20EDFB493@ALPMLVEM07.e2k.ad.ge.com> Hi there, I need to do pick a tool to do some static analysis on a large legacy application software written in C. Parasoft's "C++ test" (for C code) has features like patent-based analysis and flow-based analysis. Has anyone in this mailing list had experience with it? How does such features compare to what's offered in splint? Thanks, Forrest -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20110531/bb53c875/attachment.html From jhanley at dgtlrift.com Tue May 31 17:47:34 2011 From: jhanley at dgtlrift.com (James Hanley) Date: Tue, 31 May 2011 17:47:34 -0400 Subject: [splint-discuss] static analysis tool In-Reply-To: <8BC7D3BD84751245B2EF0731B37F02F20EDFB493@ALPMLVEM07.e2k.ad.ge.com> References: <8BC7D3BD84751245B2EF0731B37F02F20EDFB493@ALPMLVEM07.e2k.ad.ge.com> Message-ID: <-5032329613998874858@unknownmsgid> Take a look at SciTools Understand - http://www.scitools.com/ On May 31, 2011, at 4:45 PM, "Sun, Forrest (GE Healthcare)" < Forrest.Sun at med.ge.com> wrote: Hi there, I need to do pick a tool to do some static analysis on a large legacy application software written in C. Parasoft?s ?C++ test? (for C code) has features like patent-based analysis and flow-based analysis. Has anyone in this mailing list had experience with it? How does such features compare to what?s offered in splint? Thanks, Forrest _______________________________________________ splint-discuss mailing list splint-discuss at mail.cs.virginia.edu http://www.cs.virginia.edu/mailman/listinfo/splint-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20110531/41411c28/attachment.html From derek at knosof.co.uk Tue May 31 18:42:16 2011 From: derek at knosof.co.uk (Derek M Jones) Date: Tue, 31 May 2011 23:42:16 +0100 Subject: [splint-discuss] static analysis tool In-Reply-To: <8BC7D3BD84751245B2EF0731B37F02F20EDFB493@ALPMLVEM07.e2k.ad.ge.com> References: <8BC7D3BD84751245B2EF0731B37F02F20EDFB493@ALPMLVEM07.e2k.ad.ge.com> Message-ID: <4DE56EC8.1000602@knosof.co.uk> Forrest, > I need to do pick a tool to do some static analysis on a large legacy > application software written in C. Parasoft's "C++ test" (for C code) The list on Wikipedia is fairly extensive: http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis > has features like patent-based analysis and flow-based analysis. Has Would that be: United States Patent 7,900,193 "System and method for detecting defects in a computer program using data and control flow analysis"? I cannot see anything new here. > anyone in this mailing list had experience with it? How does such > features compare to what's offered in splint? > > > > Thanks, > > Forrest > > > > > > _______________________________________________ > splint-discuss mailing list > splint-discuss at mail.cs.virginia.edu > http://www.cs.virginia.edu/mailman/listinfo/splint-discuss -- Derek M. Jones tel: +44 (0) 1252 520 667 Knowledge Software Ltd mailto:derek at knosof.co.uk Source code analysis http://www.knosof.co.uk