如何解决 `int32 l[2]` 的 Splint 解析错误
How to resolve a Splint Parse Error for `int32 l[2]`
我有一些 C 代码,其中包含用于专有遗留应用程序的 header。我无法修改 header。我收到以下代码的夹板解析错误:
#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,我会在遗留问题中遇到很多其他错误 header。
你应该通过 -Dint32=int
.
splint FAQ 指出:
I develop code on an embedded system with a compiler that uses nonstandard key words and data types. I would like to run Splint on my code but these nonstandard keywords cause parse errors. What should I do?
You can often use -D
to solve this problem.
If you just want to ignore a keyword, you can add -Dnonstandardkeyword=
to make the preprocessor eliminate the keyword, where nonstandardkeyword
is the name of the keyword. Similarly, you can use -Dspecialtype=int
to make a custom type parse as an int.
我有一些 C 代码,其中包含用于专有遗留应用程序的 header。我无法修改 header。我收到以下代码的夹板解析错误:
#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,我会在遗留问题中遇到很多其他错误 header。
你应该通过 -Dint32=int
.
splint FAQ 指出:
I develop code on an embedded system with a compiler that uses nonstandard key words and data types. I would like to run Splint on my code but these nonstandard keywords cause parse errors. What should I do?
You can often use
-D
to solve this problem.If you just want to ignore a keyword, you can add
-Dnonstandardkeyword=
to make the preprocessor eliminate the keyword, wherenonstandardkeyword
is the name of the keyword. Similarly, you can use-Dspecialtype=int
to make a custom type parse as an int.