[STM8] IAR调用STM8L15x_itc.c文件编译时警告PE940

[复制链接]
819|6
 楼主| lizye 发表于 2022-6-9 19:15 | 显示全部楼层 |阅读模式
Warning[Pe940]: missing return statement at end of non-void function "ITC_GetCPUCC"请问各位大神这个警告应该怎么解决。这个库函数定义的是无符号返回,但实际函数中没有return语句,加上return还是提示警告。
wyjie 发表于 2022-6-9 19:18 | 显示全部楼层
不参加编译就可以了选择那个stm8s_itc.c 鼠标右击,Options 选择Exclude from build .我的芯片不用那个功能,所以不编译这个文件了。
juventus9554 发表于 2022-6-9 19:20 | 显示全部楼层
我也吓了一跳,正在找是为什么的时候,忽然想起这里有汇编,所以就仔细看了看注解。
juventus9554 发表于 2022-6-9 19:22 | 显示全部楼层
#ifdef _COSMIC_

  _asm("push cc");

  _asm("pop a");

  return; /* Ignore compiler warning, the returned value is in A register */

#elif defined _RAISONANCE_ /* _RAISONANCE_ */

  return _getCC_();

#else /* _IAR_ */

  asm("push cc");

  asm("pop a"); /* Ignore compiler warning, the returned value is in A register */

#endif /* _COSMIC_*/
juventus9554 发表于 2022-6-9 19:24 | 显示全部楼层
/* Ignore compiler warning, the returned value is in A register */
忽略编译警告,这个返回值在寄存器A里。
juventus9554 发表于 2022-6-9 19:26 | 显示全部楼层
因此这个函数的返回值世界上由pop a准备过了,所以下面一句return实际上就是只对应一条汇编语句的返回指令了。
 楼主| lizye 发表于 2022-6-9 19:29 | 显示全部楼层

嗯,我再好好缕一缕吧,有了好消息及时通知大家
您需要登录后才可以回帖 登录 | 注册

本版积分规则

852

主题

9757

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部