返回> 网站首页
Keil屏蔽指定的警告信息
yoours2022-09-11 10:05:07
简介一边听听音乐,一边写写文章。
一、使用keil5.37使用自身库生成代码编译提示:
warning: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint16_t *' (aka 'unsigned short *') increases required alignment from 1 to 2 [-Wcast-align]
去除方法:
在Misc Controls中填写屏蔽标记
二、屏蔽标记
1. could be declared with attribute 'noreturn' [-Wmissing-noreturn]
2. UDP_Socket.c(15): warning: no previous prototype for function 'udp_cb_func' [-Wmissing-prototypes]
3. warning: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint16_t *' (aka 'unsigned short *') increases required alignment from 1 to 2 [-Wcast-align]
4. warning: padding struct 'struct __DMA_HandleTypeDef' with 2 bytes to align 'Parent' [-Wpadded]
5. warning: implicit conversion loses integer precision: 'uint32_t' (aka 'unsigned int') to 'uint8_t' (aka 'unsigned char') [-Wimplicit-int-conversion]
略......
在每个警告末尾都会提示出警告使用的flag,将flag加入no-后,放入Misc Controls中即可屏蔽该类型警告提示信息。
如修改为:
-Wno-missing-noreturn
-Wno-missing-prototypes
-Wno-cast-align
-Wno-padded
-Wno-implicit-int-conversion
-Wno-unused-parameter