[英]defined macro '__CCP_H__' is reserved to the compiler [MISRA 2012 Rule 21.1, required]
我對此Misra警告有兩個用例,如下所述。 編譯器是否為#if定義保留了某些名稱或特定名稱而不能使用?
目前,我已經通過//lint !e9071
禁用了此警告,但是我們真的需要對此類警告采取任何措施嗎? 如果我們禁用此類警告,將會有任何影響或風險嗎?
情況1:
#ifndef __CCPPAR_H__
#define __CCPPAR_H__ //lint !e9071
#include "Ccp_Cfg.h"
#endif /* multiple inclusion protection - __CCPPAR_H__ */
觀察到的警告:
defined macro '__CCPPAR_H__' is reserved to the compiler [MISRA 2012 Rule 21.1, required]
情況2:
#ifndef __CCP_H__
#define __CCP_H__ //lint !e9071
#include "Ccppar.h"
#define MAJOR 0x02
#define MINOR 0x01
/* other parts of code */
#endif
觀察到以下Misra警告:
defined macro '__CCP_H__' is reserved to the compiler [MISRA 2012 Rule 21.1, required]
C標准(更不用說MISRA)保留以雙下划線開頭的所有令牌。
運行的實際風險是使用該符號甚至編譯器本身的C標准庫實現,與您的代碼沖突。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.