0

I run debian linux actual stable with splint and mingw installed. I want to check my c code (which I need to compile with mingw, sorry) by splint. Simply adding the mingw-includes is not enough to run. I tried with defining GNU and i686 - but I'm sure more is needed. What further do I have to define or include?

I tried the idea from loan resulting in a problem with __builtin_va_list.

Splint 3.1.2 --- 20 Feb 2009
/usr/i686-w64-mingw32/include/vadefs.h:24:43: Parse Error:
    Suspect missing struct or union keyword: __builtin_va_list :
    int. (For help on parse errors, see splint -help parseerrors.)
*** Cannot continue.

The funny thing is, that I can not find any definition for not - even with a recursive grep on the include folders. Am I searching wrong?
By defining it the way -D__builtin_va_list=va_list (from benjarobin) I ran into the error

Splint 3.1.2 --- 20 Feb 2009

/home/ebelingb/.splintrc:229:1: Setting -stats redundant with current value
/home/ebelingb/.splintrc:229:1: Setting -showsummary redundant with current
                                   value

/usr/i686-w64-mingw32/include/winnt.h:2390:15:
    Parse Error. (For help on parse errors, see splint -help parseerrors.)
*** Cannot continue.

which could not be recovered even by +trytorecover.

The lines from winnt.h (and neighbouring) reads

2388    typedef struct _EXCEPTION_POINTERS {
2389      PEXCEPTION_RECORD ExceptionRecord;
2390      PCONTEXT ContextRecord;
2391    } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS;

Strange, isn't it?

Okay as this thread gets no further answers, I'll give some motivation by this minimal not working example:
Given a file test.c

#include <windows.h>
#include <stdio.h>
#include <time.h>
#define LOGFILEFORMAT "C:\\CBM\\log\\%Y%m%d.log"
#define LOGTIMESTAMPFORMAT "%Y-%m-%d %H:%M:%S"
int main() /*int argc,char **argv*/{
Sleep(1234);
    return (0);
}

and my .splintrc

-I/usr/lib/gcc/i686-w64-mingw32/4.6/include
-I/usr/lib/gcc/i686-w64-mingw32/4.6/include-fixed
-I/usr/i686-w64-mingw32/include

the easy command splint test.c fails:

Splint 3.1.2 --- 20 Feb 2009

/usr/i686-w64-mingw32/include/_mingw.h:480:29: Parse Error:
    Suspect missing struct or union keyword: __int64 :
    long int. (For help on parse errors, see splint -help parseerrors.)
*** Cannot continue.

Again I do not know, how to setup. The includes above result from a preprocesing call of the compiler i686-w64-mingw32-gcc, which runs fine on test.c.

Bastian Ebeling
  • 1,138
  • 11
  • 38

1 Answers1

1

You can get a good list of preprocessor defines using a blank C source file and running it through GCC/MinGW with your desired custom arguments:

gcc -E -P -v -dD [optional arguments] blank.c

Be sure to use the proper compiler for your target. You can redirect the output to a file and pass whatever defines you may need from there to splint.

Ioan
  • 2,382
  • 18
  • 32
  • This is for sure a great hint. Thank you. So sad - one error remains: `/usr/i686-w64-mingw32/include/vadefs.h:24:43: Parse Error: Suspect missing struct or union keyword: __builtin_va_list : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue.` I do not know, how to resolve that problem. – Bastian Ebeling Nov 19 '13 at 06:41
  • Add `-D__builtin_va_list=va_list` ? – benjarobin Nov 19 '13 at 08:59
  • I tried that already - only resulting in another error. I'll edit the post to show that up. – Bastian Ebeling Nov 19 '13 at 14:55