Wie bekommt man Splint zum laufen?
-
Hallo zusammen,
ich habe unter Windows Splint und MinGW installiert.
Zum test von Splint nehme ich den Code von
http://de.wikipedia.org/wiki/Splint_(Software)
und speichere ihn in einer example.c Datei.Wenn ich nun Splint darauf anwende kommt das:
C:\splint\bin\splint.exe -IC:\MinGW\include -IC:\MinGW\lib\gcc\mingw32\4.5.0\inc lude "C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c" Splint 3.1.2 --- 25 Aug 2010 C:\MinGW\include\stdio.h(213,27): two `l's in integer constant Preprocessing error. (Use -preproc to inhibit warning) In file included from C:\Dokumente und Einstellungen\stefan\Eigene Dateien\ex ample.c(1) Preprocessing error for file: C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c *** Cannot continue.
In der Datei stdio.h steht aber an Zeile 213: #if __USE_MINGW_ANSI_STDIO
also nichts mit zwei "l"s. Das einzige ist in Zeile 551: return -1LL;Wenn ich die angebotene Option nutze, kommt das hier:
C:\splint\bin\splint.exe -IC:\MinGW\include -IC:\MinGW\lib\gcc\mingw32\4.5.0\inc lude -preproc "C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c" Splint 3.1.2 --- 25 Aug 2010 C:\MinGW\lib\gcc\mingw32\4.5.0\include\stddef.h(211,27): Datatype size_t declared with inconsistent type: unsigned long int A function, variable or constant is redefined with a different type. (Use -incondefs to inhibit warning) load file standard.lcd: Specification of size_t: arbitrary unsigned integral type C:\MinGW\lib\gcc\mingw32\4.5.0\include\stddef.h(323,13): Datatype wchar_t declared with inconsistent type: int load file standard.lcd: Specification of wchar_t: arbitrary integral type C:\MinGW\lib\gcc\mingw32\4.5.0\include\stddef.h(352,22): Datatype wint_t declared with inconsistent type: unsigned int load file standard.lcd: Specification of wint_t: arbitrary integral type C:\MinGW\lib\gcc\mingw32\4.5.0\include\stdarg.h(40,41): Parse Error: Suspect missing struct or union keyword: __builtin_va_list : unsigned int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue.
Wiso hat Splint nun ein Problem mit dem Datentyp von "size_t"?
Wieso findet Splint dauernd was in den Headern von MinGW?
Wie bekomme ich zu der Ausgabe die auch bei Wikipedia zu finden ist, also die Befunde meiner example.c Datei?Achja: Compilieren mit dem MinGW geht einwandfrei:
gcc -Wall -o gccout.exe "C:\Dokumente und Einstellungen\stefan\Eigene Dateien\ex ample.c" C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c: In function 'mai n': C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c:8:5: warning: sug gest parentheses around assignment used as truth value C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c:5:9: warning: 'c' is used uninitialized in this function
Danke schonmal.
-
Hallo zusammen,
ich habe es unter Linux (Gentoo) probiert, und da lief es sofort:
stefan@Athlon64 ~ $ cat example.c #include <stdio.h> int main () { char c; while (c != 'x'); { c = getchar (); if (c = 'x') return 0; switch (c) { case '\n': case '\r': printf ("Zeilenwechsel\n"); default: printf ("%c",c); } } return 0; } stefan@Athlon64 ~ $ splint example.c Splint 3.1.2 --- 08 Jan 2011 example.c: (in function main) example.c:5:10: Variable c used before definition An rvalue is used that may not be initialized to a value on some execution path. (Use -usedef to inhibit warning) example.c:5:10: Suspected infinite loop. No value used in loop test (c) is modified by test or loop body. This appears to be an infinite loop. Nothing in the body of the loop or the loop test modifies the value of the loop test. Perhaps the specification of a function called in the loop body is missing a modification. (Use -infloops to inhibit warning) example.c:7:5: Assignment of int to char: c = getchar() To make char and int types equivalent, use +charint. example.c:8:9: Test expression for if is assignment expression: c = 'x' The condition test is an assignment expression. Probably, you mean to use == instead of =. If an assignment is intended, add an extra parentheses nesting (e.g., if ((a = b)) ...) to suppress this message. (Use -predassign to inhibit warning) example.c:8:9: Test expression for if not boolean, type char: c = 'x' Test expression type is not boolean. (Use -predboolothers to inhibit warning) example.c:14:15: Fall through case (no preceding break) Execution falls through from the previous case (use /*@fallthrough@*/ to mark fallthrough cases). (Use -casebreak to inhibit warning) Finished checking --- 6 code warnings stefan@Athlon64 ~ $
Allerdings scheinen die std-Header des gcc (4.4.4) hier nicht identisch zu MinGW (4.5.0) zu sein.
-
Habe es nun mit MinGW zumlaufen bekommen, aber nur mit dieser Version:
http://e13k.tk/print.php?news.24
C:\splint_e13k\splint.exe "C:\Dokumente und Einstellungen\stefan\Eigene Dateien \example.c" Splint 3.1.2 custom build for Code::Block by __e13k__ C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c: (in function mai n) C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c(5,10): Variable c used before definition An rvalue is used that may not be initialized to a value on some execution path. (Use -usedef to inhibit warning) C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c(5,10): Suspected infinite loop. No value used in loop test (c) is modified by test or loop body. This appears to be an infinite loop. Nothing in the body of the loop or the loop test modifies the value of the loop test. Perhaps the specification of a function called in the loop body is missing a modification. (Use -infloops to inhibit warning) C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c(7,5): Assignment of int to char: c = getchar() To make char and int types equivalent, use +charint. C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c(8,9): Test expression for if is assignment expression: c = 'x' The condition test is an assignment expression. Probably, you mean to use == instead of =. If an assignment is intended, add an extra parentheses nesting (e.g., if ((a = b)) ...) to suppress this message. (Use -predassign to inhibit warning) C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c(8,9): Test expression for if not boolean, type char: c = 'x' Test expression type is not boolean. (Use -predboolothers to inhibit warning) C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c(14,15): Fall through case (no preceding break) Execution falls through from the previous case (use /*@fallthrough@*/ to mark fallthrough cases). (Use -casebreak to inhibit warning) Finished checking --- 6 code warnings
Die ist eine speziell angepasste Version für MinGW (& CodeBlocks). Ein neues Feature ist, dass die Optionen über eine ini-Datei eingelesen werden können.
Dort ist auch der Source-Code. Leider konnte ich noch nicht feststellen was genau der Unterschied zu den Original-Quellen ist, warum es nun geht.
-
Splint bringt ja einige Header, wie stdio.h, selbst mit.
Was mich nun wirklich wundert ist, wenn man als Include-Pfad die Splint-eigenen Header angibt (-IC:\splint\lib), dann gibt es von Splint (das Original) befunde:
C:\splint\bin\splint.exe -IC:\splint\lib -larchpath C:\splint\lib -lclimportdir C:\splint\imports -D_M_IX86=400 -DWIN32 -D_NTSYSTEM -D_WIN3 2_WINNT=0x0400 -DWINVER=600 -DNOGDI -DNOKERNEL -DNOUSER -DWIN32_LEAN_AND_MEAN -l ikelybool -D__int64=long -D_int64=int -D_wtoi=atoi -DSTRICT -DDECLSPEC_NORETURN= "C:\Dokumente und Einstellungen\stefan\Eigene Dateien\example.c" Splint 3.1.2 --- 25 Aug 2010 C:\splint\lib\stdio.h(10,34): Constant FILENAME_MAX declared with inconsistent type: arbitrary unsigned integral type A function, variable or constant is redefined with a different type. (Use -incondefs to inhibit warning) load file standard.lcd: Specification of FILENAME_MAX: int C:\splint\lib\stdio.h(11,34): Constant FOPEN_MAX declared with inconsistent type: arbitrary unsigned integral type load file standard.lcd: Specification of FOPEN_MAX: int C:\splint\lib\stdio.h(12,19): Constant _IOFBF declared with inconsistent type: boolean load file standard.lcd: Specification of _IOFBF: size_t C:\splint\lib\stdio.h(13,19): Constant _IOLBF declared with inconsistent type: boolean load file standard.lcd: Specification of _IOLBF: size_t C:\splint\lib\stdio.h(14,19): Constant _IONBF declared with inconsistent type: boolean load file standard.lcd: Specification of _IONBF: size_t C:\splint\lib\stdio.h(17,34): Constant L_tmpnam declared with inconsistent type: arbitrary unsigned integral type load file standard.lcd: Specification of L_tmpnam: int C:\splint\lib\stdio.h(18,34): Constant SEEK_CUR declared with inconsistent type: arbitrary unsigned integral type load file standard.lcd: Specification of SEEK_CUR: int C:\splint\lib\stdio.h(19,34): Constant SEEK_END declared with inconsistent type: arbitrary unsigned integral type load file standard.lcd: Specification of SEEK_END: int C:\splint\lib\stdio.h(20,34): Constant SEEK_SET declared with inconsistent type: arbitrary unsigned integral type load file standard.lcd: Specification of SEEK_SET: int C:\splint\lib\stdio.h(21,34): Constant TMP_MAX declared with inconsistent type: arbitrary unsigned integral type load file standard.lcd: Specification of TMP_MAX: int C:\splint\lib\stdio.h(59,32): Parse Error: Inconsistent function parameter syntax: off_t : <any>. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue.
Weiss jemand warum?