【问题标题】:PC lint error 19 "useless declaration "PC lint 错误 19“无用的声明”
【发布时间】:2018-09-26 22:41:33
【问题描述】:

我想了解 PC lint 错误 19“无用声明”的解决方案。我正在使用中断向量表,并使用所需参数调用中断。当我运行 PC lint 时,我遇到如下所示的错误 19,有人可以帮助我吗?

ifndef Int_HandlerIndAddr

#define Int_HandlerIndAddr(Isr, CpuNr, IntNr, Prio) Int_HandlerIndAddr2(Isr, CpuNr, IntNr, Prio)

endif

#define Int_HandlerIndAddr2(Isr, CpuNr, IntNr, Prio) \
__asm__ (".ifndef .intr2.entry.include                        \n"\
        ".altmacro                                           \n"\
        ".macro .int2_entry.2 intEntryLabel, Prio, name # define the section and inttab entry code \n"\
        "   .pushsection .\\intEntryLabel,\"ax\",@progbits   \n"\
        "   __\\intEntryLabel :                              \n"\
        "       bisr    Prio                                 \n"\
        "       movh.a  %a14, hi:\\name                      \n"\
        "       lea     %a14, [%a14]lo:\\name                \n"\
        "       ji      %a14                                 \n"\
        "   .popsection                                      \n"\
        ".endm                                               \n"\
        ".macro .int2_entry.1 IntNr,Prio,CpuNr,u,name           \n"\
    ".int2_entry.2 intvec_tc\\CpuNr\\u\\IntNr,%(Prio),(name) # build the unique name \n"\
        ".endm                                               \n"\
        "                                                    \n"\
        ".macro .intr2.entry name,CpuNr,IntNr,Prio           \n"\
            ".int2_entry.1 %(IntNr),%(Prio),%(CpuNr),_,name # evaluate the priority and the cpu number \n"\
        ".endm                                               \n"\
        ".intr2.entry.include:                                \n"\
        ".endif                                              \n"\
        ".intr2.entry "#Isr","#CpuNr","#IntNr","#Prio      );\ 

在同一个文件中调用函数

Int_HandlerIndAddr(TaskOs_CallTaskApp10ms, 0, ISR_NR_TASK_APP_10MS, ISR_PRIO_TASK_APP_10MS);

Int_HandlerIndAddr(TaskOs_CallTaskApp1ms, 0, ISR_NR_TASK_APP_1MS, ISR_PRIO_TASK_APP_1MS);

PC lint 错误信息如下:

Int_HandlerIndAddr(TaskOs_CallTaskApp100ms, 0, ISR_NR_TASK_APP_100MS, ISR_PRIO_TASK_APP_100MS);

C:...\0_Src\0_AppSw\Tricore\BSW\Setup\IntVecTab.c 
    107  Error 19: Useless Declaration

C:..\0_Src\0_AppSw\Tricore\BSW\Setup\IntVecTab.c 
    107  Error 19: Useless Declaration

Int_HandlerIndAddr(TaskOs_CallTaskApp10ms, 0, ISR_NR_TASK_APP_10MS, ISR_PRIO_TASK_APP_10MS);

C:......\0_Src\0_AppSw\Tricore\BSW\Setup\IntVecTab.c 
    111  Error 19: Useless Declaration

C:.....\0_Src\0_AppSw\Tricore\BSW\Setup\IntVecTab.c 
    111  Error 19: Useless Declaration

【问题讨论】:

  • 鉴于您在宏之后留下了一个空行,这段代码是否有效?这意味着宏和内联汇编器之间目前根本没有任何联系。
  • @Lundin:我认为这是我的一半错 - 原始帖子没有将代码部分格式化为代码,看起来它是从某个“双倍行距”的来源粘贴的。我修复了大部分问题,但我忽略了那个空白行。

标签: c static embedded error-suppression


【解决方案1】:

来自http://www.gimpel.com/html/pub/msg.txt(已添加重点):

19 无用的声明 -- 一个类型自己出现而没有 关联的变量,并且类型不是结构,并且 不是联合,也不是枚举。 双分号可以 导致这个如下:

  int x;;

如果您注意到,您的宏以分号结尾,并且您在调用宏时添加了一个分号。因此扩展代码有一个双分号。摆脱其中一个(我建议在宏定义中使用那个)。

【讨论】:

  • 感谢您的回复。
  • 但是我的完整代码如下。 #ifndef Int_HandlerIndAddr #define Int_HandlerIndAddr(Isr, CpuNr, IntNr, Prio) Int_HandlerIndAddr2(Isr, CpuNr, IntNr, Prio) #endif #define Int_HandlerIndAddr2(Isr, CpuNr, IntNr, Prio) \ asm (" .ifndef .intr2.entry.include \n"\ ".\n"\ ".intr2.entry "#Isr","#CpuNr","#IntNr","#Prio)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-02
  • 1970-01-01
  • 2015-02-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多