0

我运行安装了夹板和mingw的debian linux实际稳定。我想通过夹板检查我的 c 代码(我需要用 mingw 编译,对不起)。仅仅添加 mingw-includes 是不够的。我尝试定义GNU和 i686——但我确信还需要更多。我还需要定义或包括什么?

我尝试了贷款的想法,导致__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.

有趣的是,即使在包含文件夹上使用递归 grep,我也找不到任何定义。我搜索错了吗?
通过定义它的方式-D__builtin_va_list=va_list(从benjarobin)我遇到了错误

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.

即使通过 +trytorecover 也无法恢复。

winnt.h (和邻居)的行读取

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

奇怪,不是吗?

好的,因为这个线程没有进一步的答案,我将通过这个最小的不工作示例给出一些动力:
给定一个文件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);
}

和我的.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

简单的命令splint test.c失败:

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.

再次我不知道,如何设置。包含上述结果来自编译器的预处理调用,该编译器i686-w64-mingw32-gcc运行良好test.c

4

1 回答 1

1

您可以使用空白 C 源文件获得预处理器定义的良好列表,并使用所需的自定义参数通过 GCC/MinGW 运行它:

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

请务必为您的目标使用正确的编译器。您可以将输出重定向到一个文件,并将您可能需要的任何定义从那里传递给夹板。

于 2013-11-18T16:43:09.077 回答