From ibemed at gmail.com Wed Aug 1 20:17:10 2007 From: ibemed at gmail.com (=?ISO-8859-1?Q?Ib=E9ria_Medeiros?=) Date: Thu, 2 Aug 2007 00:17:10 +0000 Subject: [splint-discuss] Extensible checking for scanf Message-ID: <80bfbdd10708011717q758885aepfc2d630ccbd9357@mail.gmail.com> HI, I have been work around with extensible checking (chapter 10 in splint manual) to tainted input variables. My goal is taint any input variable. For that, i create the attribute inputness, with context reference, with 2 states - tainted and untainted, with 2 annotations inputtainted and inputuntainted, respectevely. i specify what input functions i want ensure that returned variable is inputtainted. For example, extern char *fgets (/*@returned@*/ char *s, int n, FILE *stream) /*@ensures inputtainted s@*/; (here i grant that s will be tainted) extern /*@inputtainted@*/ int getchar(void) /*@ensures inputtainted@*/; (here i grant that returned value is tainted) but, for scanf function how i can grant that returned variable is inputtainted?? In a first approach i define scanf: extern int scanf(const char *format, ...) /*@ensures inputtainted ...@*/; but splint give me a parse error, because dont accept "..." parameter any help? regards, -- Ib?ria Medeiros From liranorevi at hotmail.com Sat Aug 4 14:51:34 2007 From: liranorevi at hotmail.com (Liran Orevi) Date: Sat, 4 Aug 2007 18:51:34 +0000 Subject: [splint-discuss] tab, no warnings but gcc doesn't compile, search splint-discuss Message-ID: Hello, 1)Is there a way to tell Splint to count the TAB char as more than one char? currently the horizontal numbers don't match with those of my editor. 2)I have an example that shows no warnings by Splint, yet doesn't compile using GCC version 4.0.3, how can this be? below is the code, 1.c compiles and 2.c doesn't compile. 3)Is there a good way to search splint-discuss? Many thanks, Liran ******************************************************************************* liran at best-computer3:~/Learn/Source/4$ cat 1.c #include #include static int add1(int int1, int int2); int main(){ int int1=5; int int2=3; printf("%d",add1(int1,int2)); return (EXIT_SUCCESS); } int add1(int int1, int int2){ return(int1 + int2); } liran at best-computer3:~/Learn/Source/4$ splint 1.c Splint 3.1.2 --- 02 Aug 2007 Finished checking --- no warnings liran at best-computer3:~/Learn/Source/4$ gcc 1.c liran at best-computer3:~/Learn/Source/4$ liran at best-computer3:~/Learn/Source/4$ cat 2.c #include #include int main(){ static int add1(int int1, int int2); int int1=5; int int2=3; printf("%d",add1(int1,int2)); return (EXIT_SUCCESS); } int add1(int int1, int int2){ return(int1 + int2); } liran at best-computer3:~/Learn/Source/4$ splint 2.c Splint 3.1.2 --- 02 Aug 2007 Finished checking --- no warnings liran at best-computer3:~/Learn/Source/4$ gcc 2.c 2.c: In function ?main?: 2.c:7: error: invalid storage class for function ?add1? _________________________________________________________________ Make every IM count. Download Windows Live Messenger and join the i?m Initiative now. It?s free.? http://im.live.com/messenger/im/home/?source=TAGWL_June07 From Michael.Wojcik at MicroFocus.com Mon Aug 6 07:50:51 2007 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Mon, 6 Aug 2007 04:50:51 -0700 Subject: [splint-discuss] tab, no warnings but gcc doesn't compile, search splint-discuss In-Reply-To: References: Message-ID: <11352F9641010A418AD5057945A3A6598B44D6@MTV-EXCHANGE.microfocus.com> > 2)I have an example that shows no warnings by Splint, yet > doesn't compile using GCC version 4.0.3, how can this be? Splint is not required to detect every condition that would prevent another implementation from translating a source unit. Why would it be? > int > main(){ > > static int add1(int int1, int int2); This is illegal. A function declaration at function scope cannot have the static sc-specifier. See ISO 9899-1999 6.7.1 #5: "The declaration of an identifier for a function that has block scope shall have no explicit storage-class specifier other than extern". Since it's a violation of the standard, no implementation is required to translate it. Since it's not a constraint violation, no implementation is required to issue a diagnostic for it. Thus both Splint and GCC are conformant in this case. While it might be nice if Splint warned you about this, Splint is not perfect. -- Michael Wojcik From herbert at the-little-red-haired-girl.org Fri Aug 10 18:40:02 2007 From: herbert at the-little-red-haired-girl.org (Martin Dietze) Date: Sat, 11 Aug 2007 00:40:02 +0200 Subject: [splint-discuss] splint 3.1.2 for OS/2 (Re: Releasing 3.1.2) In-Reply-To: <469801B0.2060204@cs.virginia.edu> References: <1A3B51A8-AF7D-4D47-B3A8-2097814034C1@petdance.com> <469801B0.2060204@cs.virginia.edu> Message-ID: <20070810224002.GA3456@fh-wedel.de> On Fri, July 13, 2007, David Evans wrote: > I've updated the source code distribution to 3.1.2 (which is posted now > on splint.org), to incorporate the latest CVS version (with a few more > minor fixes). The CVS code and source code distribution are now the same. > > Thanks for the prodding, I should have done this a long time ago... I just uploaded an updated OS/2 port to [1]. BTW has anyone running a non-Unix-version (e.g. Win32) noticed anything weird with the `tainted' self test? On OS/2 the second test in the tainted subdir does not succeed, actually splint does not emit any of the expected warnings on the `tainted-bad.mts' file. Cheers, Martin [1] http://www.fh-wedel.de/pub/fh-wedel/staff/herbert/splint -- ----------- / http://herbert.the-little-red-haired-girl.org / ------------- =+= Chinese is a lousy language for scrabble -- Neal Stephenson From herbert at the-little-red-haired-girl.org Fri Aug 10 18:40:02 2007 From: herbert at the-little-red-haired-girl.org (Martin Dietze) Date: Sat, 11 Aug 2007 00:40:02 +0200 Subject: [splint-discuss] splint 3.1.2 for OS/2 (Re: Releasing 3.1.2) In-Reply-To: <469801B0.2060204@cs.virginia.edu> References: <1A3B51A8-AF7D-4D47-B3A8-2097814034C1@petdance.com> <469801B0.2060204@cs.virginia.edu> Message-ID: <20070810224002.GA3456@fh-wedel.de> On Fri, July 13, 2007, David Evans wrote: > I've updated the source code distribution to 3.1.2 (which is posted now > on splint.org), to incorporate the latest CVS version (with a few more > minor fixes). The CVS code and source code distribution are now the same. > > Thanks for the prodding, I should have done this a long time ago... I just uploaded an updated OS/2 port to [1]. BTW has anyone running a non-Unix-version (e.g. Win32) noticed anything weird with the `tainted' self test? On OS/2 the second test in the tainted subdir does not succeed, actually splint does not emit any of the expected warnings on the `tainted-bad.mts' file. Cheers, Martin [1] http://www.fh-wedel.de/pub/fh-wedel/staff/herbert/splint -- ----------- / http://herbert.the-little-red-haired-girl.org / ------------- =+= Chinese is a lousy language for scrabble -- Neal Stephenson From liranorevi at hotmail.com Tue Aug 14 09:51:29 2007 From: liranorevi at hotmail.com (Liran Orevi) Date: Tue, 14 Aug 2007 13:51:29 +0000 Subject: [splint-discuss] const tests Message-ID: Hello, Does Splint checks 'const' related actions? Below are some examples. Many Thanks, Liran CONST INT -------------------- liran at best-computer3:~/Learn/Source/SplintTries$ liran at best-computer3:~/Learn/Source/SplintTries$ cat 4.c #include #include int main() { const int int1 = 5; int1 = 6; exit(EXIT_SUCCESS); } liran at best-computer3:~/Learn/Source/SplintTries$ splint 4.c Splint 3.1.2 --- 02 Aug 2007 Finished checking --- no warnings liran at best-computer3:~/Learn/Source/SplintTries$ gcc 4.c -o 4 4.c: In function ?main?: 4.c:8: error: assignment of read-only variable ?int1? CONST POINTER --------------------------------- liran at best-computer3:~/Learn/Source/SplintTries$ liran at best-computer3:~/Learn/Source/SplintTries$ cat 3.c #include #include static void changeString(const char *char1) { *char1='H'; } int main() { char char1[6] = "hello"; printf("before: %s\n",char1); changeString(char1); printf("after: %s\n",char1); exit(EXIT_SUCCESS); } liran at best-computer3:~/Learn/Source/SplintTries$ splint 3.c Splint 3.1.2 --- 02 Aug 2007 Finished checking --- no warnings liran at best-computer3:~/Learn/Source/SplintTries$ gcc 3.c -o 3 3.c: In function ?changeString?: 3.c:7: error: assignment of read-only location CONST POINTER COPY (warned by Gcc) ----------------------------------------------------------- liran at best-computer3:~/Learn/Source/SplintTries$ liran at best-computer3:~/Learn/Source/SplintTries$ cat 2.c #include #include static void changeString(const char *char1) { char *charPointer1=char1; *charPointer1='H'; } int main() { char char1[6] = "hello"; printf("before: %s\n",char1); changeString(char1); printf("after: %s\n",char1); exit(EXIT_SUCCESS); } liran at best-computer3:~/Learn/Source/SplintTries$ splint 2.c Splint 3.1.2 --- 02 Aug 2007 Finished checking --- no warnings liran at best-computer3:~/Learn/Source/SplintTries$ gcc 2.c -o 2 2.c: In function ?changeString?: 2.c:7: warning: initialization discards qualifiers from pointer target type liran at best-computer3:~/Learn/Source/SplintTries$ ./2 before: hello after: Hello _________________________________________________________________ With Windows Live Hotmail, you can personalize your inbox with your favorite color. www.windowslive-hotmail.com/learnmore/personalize.html?locale=en-us&ocid=TXT_TAGLM_HMWL_reten_addcolor_0607 From iwm at doc.ic.ac.uk Tue Aug 14 10:38:01 2007 From: iwm at doc.ic.ac.uk (Ian Moor) Date: Tue, 14 Aug 2007 15:38:01 +0100 (BST) Subject: [splint-discuss] Use of splint Message-ID: <9954213.61187102281746.JavaMail.ICEMail@snegopad> After a couple of recent messages : 'const tests' and 'no warnings but gcc doesn't compile' I think that splint is a tool to used after the compiler has run with no errors or warnings, because splint can't be expected to correctly report the errors it is aimed for if the program has other errors. Ian Moor Ian W Moor Department of Computing, iwm at doc.ic.ac.uk Imperial College. 180 Queensgate London SW7 2AZ UK. From Sebastian.Matuschka at gcd-solutions.de Wed Aug 15 03:29:20 2007 From: Sebastian.Matuschka at gcd-solutions.de (Matuschka, Sebastian) Date: Wed, 15 Aug 2007 09:29:20 +0200 Subject: [splint-discuss] empedded programming, __interrupt Message-ID: <49ED01FC03EE524BB7BB258E8F93BFF311C67A@bfl-exchange-1.BFL.local> Hello, i want to use splint for analysis on c code for empedded systems. The compiler (i.e. FUJITSU) for embedded code accepts some additional things like "__interrupt" for defining a function as an interrupt. As of the nature of an interrupt this function gets never called in the code. But i do want splint to check if other functions which are no interrupts are used. And here is the problem. When i call splint with the option -D__interrupt=const i get no warnings because __interrupt is unknown to splint, but splint warns because the interrupt function is unused. So how can i tell splint that all functions which look like __interrupt void intIOTimer (void) { ... } are not called in my program and therefor it isn't neccessary to warn that they are unused. I don't want to write %@unused@% in front of every interrupt, i want that splint knows this because of the __interrupt. I have compiled splint 3.1.2 on windows and made some little changes on the code, so i know a bit about the splint sources and how splint works. But it is a bit too much for me to change the bison and lex parser and these arrays full of numbers like yytoknum, yyr1 and so on so it knows __interrupt for example. I am thankful for every idea or hint how to solve this problem. Greetings Sebastian Matuschka -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20070815/a86920eb/attachment-0001.html From Sebastian.Matuschka at gcd-solutions.de Wed Aug 15 04:22:06 2007 From: Sebastian.Matuschka at gcd-solutions.de (Matuschka, Sebastian) Date: Wed, 15 Aug 2007 10:22:06 +0200 Subject: [splint-discuss] empedded programming, __interrupt (plain txt, no html, sorry) Message-ID: <49ED01FC03EE524BB7BB258E8F93BFF311C67C@bfl-exchange-1.BFL.local> Sorry i forgot to change to "only text", here is the mail in plain text, no html Hello, i want to use splint for analysis on c code for empedded systems. The compiler (i.e. FUJITSU) for embedded code accepts some additional things like "__interrupt" for defining a function as an interrupt. As of the nature of an interrupt this function gets never called in the code. But i do want splint to check if other functions which are no interrupts are used. And here is the problem. When i call splint with the option -D__interrupt=const i get no warnings because __interrupt is unknown to splint, but splint warns because the interrupt function is unused. So how can i tell splint that all functions which look like __interrupt void intIOTimer (void) { ... } are not called in my program and therefor it isn't neccessary to warn that they are unused. I don't want to write %@unused@% in front of every interrupt, i want that splint knows this because of the __interrupt. I have compiled splint 3.1.2 on windows and made some little changes on the code, so i know a bit about the splint sources and how splint works. But it is a bit too much for me to change the bison and lex parser and these arrays full of numbers like yytoknum, yyr1 and so on so it knows __interrupt for example. I am thankful for every idea or hint how to solve this problem. Greetings Sebastian Matuschka From Ralf.Wildenhues at gmx.de Wed Aug 15 04:40:27 2007 From: Ralf.Wildenhues at gmx.de (Ralf Wildenhues) Date: Wed, 15 Aug 2007 10:40:27 +0200 Subject: [splint-discuss] empedded programming, __interrupt In-Reply-To: <49ED01FC03EE524BB7BB258E8F93BFF311C67A@bfl-exchange-1.BFL.local> References: <49ED01FC03EE524BB7BB258E8F93BFF311C67A@bfl-exchange-1.BFL.local> Message-ID: <20070815084027.GC17520@ins.uni-bonn.de> Hello Sebastian, * Matuschka, Sebastian wrote on Wed, Aug 15, 2007 at 09:29:20AM CEST: > > So how can i tell splint that all functions which look like > __interrupt void intIOTimer (void) > { > ... > } > are not called in my program and therefor it isn't neccessary to warn > that they are unused. > I don't want to write %@unused@% in front of every interrupt, i want > that splint knows this because of the __interrupt. You could put something like the following in a header file. #ifdef S_SPLINT_S /*@-namechecks@*/ # define __interrupt /*@unused@*/ /*@=namechecks@*/ #endif Hope that helps. Cheers, Ralf From Sebastian.Matuschka at gcd-solutions.de Wed Aug 15 07:47:57 2007 From: Sebastian.Matuschka at gcd-solutions.de (Matuschka, Sebastian) Date: Wed, 15 Aug 2007 13:47:57 +0200 Subject: [splint-discuss] empedded programming, __interrupt In-Reply-To: <20070815084027.GC17520@ins.uni-bonn.de> References: <49ED01FC03EE524BB7BB258E8F93BFF311C67A@bfl-exchange-1.BFL.local> <20070815084027.GC17520@ins.uni-bonn.de> Message-ID: <49ED01FC03EE524BB7BB258E8F93BFF311C684@bfl-exchange-1.BFL.local> Hello Ralf, >You could put something like the following in a header file. > > #ifdef S_SPLINT_S > /*@-namechecks@*/ > # define __interrupt /*@unused@*/ > /*@=namechecks@*/ > #endif That sounds good, yes. I don't want to include it in a header in the sources of the embedded project, so i made a library and let it load in the splint rc file. I called the new library standard_softune.h and created a standard_softune.lcd out of it. In the splint rc file i added this line: -load ..\lib\standard_softune.lcd As far as i can see splint accepts this. I added /*@-namechecks@*/ # define __nosavereg # define __interrupt /*@unused@*/ /*@=namechecks@*/ to the standard_softune.h but i guess that splint doesn't understand it correctly, the line in the .lcd file is: ^22 0|@11|^#__nosavereg#__interrupt I think that the namechecks commands are interpreted when creating the lib but then are not in the lib file itself. I have no idea how to avoid this. I could write two /*@-namechecks@*/ one after the other. But that doesn't work. Sebastian From Ralf.Wildenhues at gmx.de Wed Aug 15 08:43:13 2007 From: Ralf.Wildenhues at gmx.de (Ralf Wildenhues) Date: Wed, 15 Aug 2007 14:43:13 +0200 Subject: [splint-discuss] empedded programming, __interrupt In-Reply-To: <49ED01FC03EE524BB7BB258E8F93BFF311C684@bfl-exchange-1.BFL.local> References: <49ED01FC03EE524BB7BB258E8F93BFF311C67A@bfl-exchange-1.BFL.local> <20070815084027.GC17520@ins.uni-bonn.de> <49ED01FC03EE524BB7BB258E8F93BFF311C684@bfl-exchange-1.BFL.local> Message-ID: <20070815124313.GB17497@ins.uni-bonn.de> * Matuschka, Sebastian wrote on Wed, Aug 15, 2007 at 01:47:57PM CEST: > > I added > /*@-namechecks@*/ > # define __nosavereg > # define __interrupt /*@unused@*/ > /*@=namechecks@*/ > to the standard_softune.h but i guess that splint doesn't understand it > correctly, the line in the .lcd file is: > ^22 0|@11|^#__nosavereg#__interrupt > I think that the namechecks commands are interpreted when creating the > lib but then are not in the lib file itself. But that is all that's needed, no? I added the -namechecks only to avoid the warning about __interrupt in the #define line, not for the actual function declarations/definitions. splint need not remember anything about temporary flags changes in the sources to .lcd files AFAICS. Cheers, Ralf From Sebastian.Matuschka at gcd-solutions.de Wed Aug 15 08:48:04 2007 From: Sebastian.Matuschka at gcd-solutions.de (Matuschka, Sebastian) Date: Wed, 15 Aug 2007 14:48:04 +0200 Subject: [splint-discuss] empedded programming, __interrupt In-Reply-To: <49ED01FC03EE524BB7BB258E8F93BFF311C684@bfl-exchange-1.BFL.local> References: <49ED01FC03EE524BB7BB258E8F93BFF311C67A@bfl-exchange-1.BFL.local><20070815084027.GC17520@ins.uni-bonn.de> <49ED01FC03EE524BB7BB258E8F93BFF311C684@bfl-exchange-1.BFL.local> Message-ID: <49ED01FC03EE524BB7BB258E8F93BFF311C687@bfl-exchange-1.BFL.local> Hello, Lastly i found the point where to add code if it is an __interrupt: cscannerHelp.c(line 1545) in int cscannerHelp_processIdentifier(cstring id) I added in line 1637: else if (cstring_equalLit (id, "__interrupt")) { tok = QUNUSED; } That works for me :) Greetings Sebastian > > Hello Ralf, > > >You could put something like the following in a header file. > > > > #ifdef S_SPLINT_S > > /*@-namechecks@*/ > > # define __interrupt /*@unused@*/ > > /*@=namechecks@*/ > > #endif > > That sounds good, yes. > I don't want to include it in a header in the sources of the > embedded project, so i made a library and let it load in the > splint rc file. > I called the new library standard_softune.h and created a > standard_softune.lcd out of it. > In the splint rc file i added this line: > -load ..\lib\standard_softune.lcd > As far as i can see splint accepts this. > I added > /*@-namechecks@*/ > # define __nosavereg > # define __interrupt /*@unused@*/ > /*@=namechecks@*/ > to the standard_softune.h but i guess that splint doesn't > understand it correctly, the line in the .lcd file is: > ^22 0|@11|^#__nosavereg#__interrupt > I think that the namechecks commands are interpreted when > creating the lib but then are not in the lib file itself. > I have no idea how to avoid this. I could write two > /*@-namechecks@*/ one after the other. But that doesn't work. > > Sebastian From splint at brodale.net Wed Aug 15 22:05:19 2007 From: splint at brodale.net (d.brodale) Date: Wed, 15 Aug 2007 22:05:19 -0400 (EDT) Subject: [splint-discuss] Splint 3.1.2 build failure (OS X 10.4.10) Message-ID: Splint 3.1.2 fails to build for OS X 10.4.10, though version 3.1.1 seemed to without issue. Past the `./configure` stage, `make` errors out here: 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: parse error before 'pid' osd.c:522: error: 'pid' undeclared (first use in this function) make[3]: *** [osd.o] Error 1 make[2]: *** [Headers/flag_codes.gen] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Any suggestions from the list? Of lesser concern, the documentation bundled with Splint 3.1.2 still references version 3.1.1 within install.html. -don From jjose at globo.com Tue Aug 21 11:41:42 2007 From: jjose at globo.com (juan abba) Date: Tue, 21 Aug 2007 12:41:42 -0300 Subject: [splint-discuss] SFR definition acceptable to SPLINT Message-ID: <46CB07B6.2070201@globo.com> I am trying to run SPLINT over a "C" program written for the Z* of ZIlog. All the SFR definition are giving me "parse errors" Their compiler defines ( at the "processor.H file") a SFR as follows #define PCADDR (*(unsigned char volatile far*)0xFD8) // Port C Address I am trying to find a way to use following #if defined S_SPLINT_S #define PCADDR char *unsigned char * #else #define PCADDR (*(unsigned char volatile far*)0xFD8) // Port C Address #endif SPLINT accepts it when the "processor.H file" is parsed, but on the first time the PCADDR is called, like PCADDR = 0; when parsing any of the xxx.c programs, it gives a parse error. will appreciate any help a lot juan abba -- Amigo, antes de lhe enviar este e-mail tive o cuidado de remover todos os endere?os que porventura vieram no texto original. Fiz isto para eliminar o risco de hackers extra?rem os e-mails que vieram junto com a mensagem e os utilizarem para envio de "spam". Sugiro que se for re-enviar este e-mail tome o mesmo cuidado e, mais, como seguran?a adicional, endere?em seus amigos no campo Cco ou Bcc. Voc? os estar? protegendo e a si mesmo. Juan Jose From lholzheid at bihl-wiedemann.de Tue Aug 21 12:41:33 2007 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Tue, 21 Aug 2007 18:41:33 +0200 Subject: [splint-discuss] SFR definition acceptable to SPLINT In-Reply-To: <46CB07B6.2070201@globo.com> References: <46CB07B6.2070201@globo.com> Message-ID: <20070821164133.GA32505@svr5.bihl-wiedemann.de> On Tue, 2007-08-21 12:41:42 -0300, juan abba wrote: > [..] > I am trying to find a way to use following > > #if defined S_SPLINT_S > #define PCADDR char *unsigned char * > #else > #define PCADDR (*(unsigned char volatile far*)0xFD8) // > Port C Address > #endif Hello Juan, I don't understand the definition you made for splint. The definition for the Zilog compiler says something like 'take 0xFD8 as an address of an unsigned char variable and access this variable'. So, I think, the symbol 'PCADDR' is to be used e.g. as follows: PCADDR = 0x03; or if (0x00 != (PCADDR & 0x04)) { ... } Why don't you declare an unsigned char named 'PCADDR' to make splint happy? # if defined S_SPLINT_S extern unsigned char PCADDR; # else # define PCADDR (*(unsigned char volatile far*)0xFD8) # endif HTH, Ludolf -- --------------------------------------------------------------- Ludolf Holzheid Tel: +49 621 339960 Bihl+Wiedemann GmbH Fax: +49 621 3392239 Flo?w?rthstra?e 41 e-mail: lholzheid at bihl-wiedemann.de D-68199 Mannheim, Germany --------------------------------------------------------------- From jjose at globo.com Tue Aug 21 14:24:43 2007 From: jjose at globo.com (juan abba) Date: Tue, 21 Aug 2007 15:24:43 -0300 Subject: [splint-discuss] SFR definition acceptable to SPLINT In-Reply-To: <20070821164133.GA32505@svr5.bihl-wiedemann.de> References: <46CB07B6.2070201@globo.com> <20070821164133.GA32505@svr5.bihl-wiedemann.de> Message-ID: <46CB2DEB.4040607@globo.com> I appreciate a lot your fast, simple and effective answer. It works 100% for most SFR Address I am using. for some reason that I do not understand it requires "not for all, but just for a few of them", on one of the C files, an additional declaration like: #if defined S_SPLINT_S char unsigned PCADDR , PCCTL, PCIN, PCOUT; #endif but as I said, it works 100% thanks again juan Ludolf Holzheid wrote: > On Tue, 2007-08-21 12:41:42 -0300, juan abba wrote: > >> [..] >> I am trying to find a way to use following >> >> #if defined S_SPLINT_S >> #define PCADDR char *unsigned char * >> #else >> #define PCADDR (*(unsigned char volatile far*)0xFD8) // >> Port C Address >> #endif >> > > > Hello Juan, > > I don't understand the definition you made for splint. > > The definition for the Zilog compiler says something like 'take 0xFD8 > as an address of an unsigned char variable and access this variable'. > So, I think, the symbol 'PCADDR' is to be used e.g. as follows: > > PCADDR = 0x03; > > or > > if (0x00 != (PCADDR & 0x04)) > { > ... > } > > > Why don't you declare an unsigned char named 'PCADDR' to make splint > happy? > > # if defined S_SPLINT_S > extern unsigned char PCADDR; > # else > # define PCADDR (*(unsigned char volatile far*)0xFD8) > # endif > > HTH, > > Ludolf > > > -- Amigo, antes de lhe enviar este e-mail tive o cuidado de remover todos os endere?os que porventura vieram no texto original. Fiz isto para eliminar o risco de hackers extra?rem os e-mails que vieram junto com a mensagem e os utilizarem para envio de "spam". Sugiro que se for re-enviar este e-mail tome o mesmo cuidado e, mais, como seguran?a adicional, endere?em seus amigos no campo Cco ou Bcc. Voc? os estar? protegendo e a si mesmo. Juan Jose -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20070821/4b933a23/attachment-0001.html From ok at cs.otago.ac.nz Wed Aug 22 22:24:27 2007 From: ok at cs.otago.ac.nz (ok) Date: Thu, 23 Aug 2007 14:24:27 +1200 Subject: [splint-discuss] SFR definition acceptable to SPLINT In-Reply-To: <46CB07B6.2070201@globo.com> References: <46CB07B6.2070201@globo.com> Message-ID: #ifdef S_SPLINT_S #define far #endif That's the only non-C thing about (*(unsigned char volatile far*)0xFD8) From Sebastian.Matuschka at gcd-solutions.de Thu Aug 30 00:21:24 2007 From: Sebastian.Matuschka at gcd-solutions.de (Matuschka, Sebastian) Date: Thu, 30 Aug 2007 09:21:24 +0200 Subject: [splint-discuss] check if type is struct pointer In-Reply-To: References: <46CB07B6.2070201@globo.com> Message-ID: <49ED01FC03EE524BB7BB258E8F93BFF311C863@bfl-exchange-1.BFL.local> Hello, in the splint source code(ctype.c) ctype_getBaseType() there is only a switch clause for array pointers: ######code start####### ctype ctype_getBaseType (ctype c) { ctentry cte = ctype_getCtentry (c); switch (ctentry_getKind (cte)) { case CTK_UNKNOWN: case CTK_INVALID: case CTK_PLAIN: return c; case CTK_PTR: case CTK_ARRAY: return (ctype_getBaseType (ctype_baseArrayPtr (c))); case CTK_COMPLEX: { ... ######code end####### but how can i recogize a struct pointer? i have code (which splint should test) like: ######code start####### //structures typedef struct { int iSTest1; unsigned char ucSTest2; long lTest; }StrutSplintT2; struct strTest{ int iBlab; }; struct strTest2 { int iAbalkd; } struct StrutSplintT2 *pointerstrTest; ######code end####### ctype_isStruct() says pointerstrTest is no struct, ctype_isPointer() says it is a pointer, thats ok. is there any other way to check if an uentry or ctype is a struct pointer? i could parse the string which is returned by ctype_unparse(), but thats not really a solution for me. maybe someone has an idea? Cheers Sebastian From Sebastian.Matuschka at gcd-solutions.de Thu Aug 30 23:17:50 2007 From: Sebastian.Matuschka at gcd-solutions.de (Matuschka, Sebastian) Date: Fri, 31 Aug 2007 08:17:50 +0200 Subject: [splint-discuss] Function pointers Message-ID: <49ED01FC03EE524BB7BB258E8F93BFF311C887@bfl-exchange-1.BFL.local> Hello, next problem: When i try to identify function pointers and do a name check (which i have advanced), there occure two warnings which have the same text, except that one warning says that the function pointer which is overgiven as parameter is a parameter which should be correct and the other warning says it is a Variable: C:\Softune\sample\907\splint_test\Src\splinttest.c: (in function testfct) *** C:\Softune\sample\907\splint_test\Src\splinttest.c(44) 22: The name of the Parameter pfd2Func violates naming convention. The prefix pfd is not correct for type [function (float, float) returns float] *. The correct prefix is: pf Variable name is not consistent with naming convention. (Use either -slovakvars or -namechecks to inhibit warning) *** C:\Softune\sample\907\splint_test\Src\splinttest.c(44) 22: The name of the Variable pfd2Func violates naming convention. The prefix pfd is not correct for type [function (float, float) returns float] *. The correct prefix is: pf Variable name is not consistent with naming convention. (Use either -slovakvars or -namechecks to inhibit warning) splint creates two different uentries for the same function pointer. any ideas why or how i can fix this? is it a problem in cgrammar.y? Best Regards Sebastian From Sebastian.Matuschka at gcd-solutions.de Fri Aug 31 00:35:24 2007 From: Sebastian.Matuschka at gcd-solutions.de (Matuschka, Sebastian) Date: Fri, 31 Aug 2007 09:35:24 +0200 Subject: [splint-discuss] Function pointers In-Reply-To: <49ED01FC03EE524BB7BB258E8F93BFF311C887@bfl-exchange-1.BFL.local> References: <49ED01FC03EE524BB7BB258E8F93BFF311C887@bfl-exchange-1.BFL.local> Message-ID: <49ED01FC03EE524BB7BB258E8F93BFF311C889@bfl-exchange-1.BFL.local> what could be interesting is the line 44 where the warnings occur: 44 void testfct(float (*pfd2Func)(float a, float b)) 45 { 46 ... Sebastian > -----Urspr?ngliche Nachricht----- > Von: splint-discuss-bounces at cs.virginia.edu > [mailto:splint-discuss-bounces at cs.virginia.edu] Im Auftrag > von Matuschka, Sebastian > Gesendet: Freitag, 31. August 2007 08:18 > An: splint-discuss at mail.cs.virginia.edu > Betreff: [splint-discuss] Function pointers > > Hello, > > next problem: > > When i try to identify function pointers and do a name check > (which i have advanced), there occure two warnings which have > the same text, except that one warning says that the function > pointer which is overgiven as parameter is a parameter which > should be correct and the other warning says it is a Variable: > > C:\Softune\sample\907\splint_test\Src\splinttest.c: (in function > testfct) > *** C:\Softune\sample\907\splint_test\Src\splinttest.c(44) 22: > The name of the Parameter pfd2Func violates naming > convention. The prefix pfd is not correct for type [function > (float, float) returns float] *. The correct prefix is: pf > Variable name is not consistent with naming convention. > (Use either -slovakvars or -namechecks to inhibit warning) > > *** C:\Softune\sample\907\splint_test\Src\splinttest.c(44) 22: > The name of the Variable pfd2Func violates naming > convention. The prefix pfd is not correct for type [function > (float, float) returns float] *. The correct prefix is: pf > Variable name is not consistent with naming convention. > (Use either -slovakvars or -namechecks to inhibit warning) > > splint creates two different uentries for the same function pointer. > any ideas why or how i can fix this? is it a problem in cgrammar.y? > > Best Regards > > Sebastian > > _______________________________________________ > splint-discuss mailing list > splint-discuss at mail.cs.virginia.edu > http://www.cs.virginia.edu/mailman/listinfo/splint-discuss >