C编译器中对h文件的重重包含导致的预处理不同的问题

在.h文件中使用以下代码

extern __inline__ Mcal_WdtCalcSeqPassword(uint16 SeqPassword)
{
/*IFX_MISRA_RULE_08_05_STATUS=Allowed for inline functions defined in header
files*/
uint16 InterPasswordl;
/*IFX_MISRA_RULE_08_05_STATUS=Allowed for inline functions defined in header
files*/
uint16 Expected_Passl;
/* calculate 2nd bit position value */
InterPasswordl = ((SeqPassword >> 15U)^(SeqPassword >> 14U)^
(SeqPassword >> 13U)^(SeqPassword >> 3U)) & 1U;
/*shift each each bit by 1 towards left */
Expected_Passl = (uint16)(((uint16)(SeqPassword << 1U)|
(uint16)(InterPasswordl << 2U)) & 0x0000FFFFU);
/* return the calculated next sequence password value */
return(Expected_Passl);
}

不会报错。

但是一旦使用其他形式的修饰,比如在illd中经常使用的

static __inline__ __attribute__((__always_inline__))

就会报错。

原文地址:https://www.cnblogs.com/praiseslow/p/13723902.html