-1

我有一些 C 代码,其中包含专有旧应用程序的标头。我无法修改标题。我收到以下代码的夹板解析错误:

#if defined(HAS_LONGLONG)
    /* removed for brevity */
#elif defined(HAS_INT64)
    /* removed for brevity */
#else
  typedef union {
    int32   l[2]; /* This is the line that is causing the parse error in splint */
    double  d;
  } int64;
#endif

是否有任何参数可以传递给夹板以使其正常工作?

该平台是 64 位的,但旧版应用程序是 32 位的。

我正在运行夹板:

[me@host]$ splint -I/path/to/include -preprox -warnposix

Splint 3.1.1 --- 28 Apr 2003
/path/to/include/some_header.h:7:10:
    Parse Error. (For help on parse errors, see splint -help parseerrors.)
*** Cannot continue.

如果没有 -preprox 和 -warnposix,我会在遗留标头中收到很多其他错误。

4

1 回答 1

1

你应该通过-Dint32=int

夹板常见问题解答指出:

  1. 我使用非标准关键字和数据类型的编译器在嵌入式系统上开发代码。我想在我的代码上运行 Splint,但这些非标准关键字会导致解析错误。我该怎么办?

    你可以经常使用-D来解决这个问题。

    如果只想忽略某个关键字,可以添加-Dnonstandardkeyword=使预处理器消除关键字,其中nonstandardkeyword是关键字的名称。同样,您可以使用-Dspecialtype=int将自定义类型解析为 int。

于 2019-12-07T01:28:11.483 回答