__asm 和 PCLint 9.0L 错误 14:先前定义的符号“TS_IntDisableAsm(void)”

问题描述

我对项目使用了 PCLint-Check 9.0L,并在对项目的所有 Lint-Object-Files(*.lob) 进行 Lint-Check 期间得到了当前的错误消息:

  • W:\DevWA\src\Platforms_h\TSPlatforms.h 错误 14:先前定义的符号“TS_IntdisableAsm(void)”(第 90 行,文件 W:\DevWA\src\Platforms_h\TSPlatforms.h) h,模块 TSPlatforms.c)

PCLInt 帮助手册在此处解释: Symbol 'Symbol' prevIoUs defined (Location) -- 命名对象已被第二次定义。

但是在第 90 行的 TSPlatforms.h 中,整个 Project 中只有以下定义:

#define TS_Intdisable()     TS_IntdisableAsm()
__asm TS_IntStatusType TS_IntdisableAsm(void)
{
 .set noreorder
! "r3"
    mfmsr   r3
    wrteei  0
 .set reorder
}

TSPlatforms.h 多次包含在我项目的不同 C 文件中,但代码当然包含在重新定义保护中:

#if (!defined TSPLATFORMS_H)
#define TSPLATFORMS_H
...
#endif

有人提示我识别错误吗?

谢谢! 海杰

解决方法

我的猜测:代码 TS_IntDisableAsm() 旨在内联。 PCLint 不知道这一点,并认为它是在多个 .c 文件中定义的,并且当所有内容链接在一起时会发生冲突。

在声明前添加 static 关键字应该会有所帮助。