On Wed, Mar 24, 2021 at 09:30:58AM +0100, Thomas Monjalon wrote: > 24/03/2021 05:26, Tyler Retzlaff: > > +#ifndef __cplusplus > > #ifndef asm > > #define asm __asm__ > > #endif > > +#endif > > It requires more explanations. > Which compilers do not define asm? > What happens with C++ if asm is undefined?
i guess the subject line on my commit didn't communicate this properly sorry. asm is a keyword in both the C and C++ standards. for C++ the keyword is not permitted to be re-defined. here is the relevant text from the standard, in particular item (2). 17.6.4.3.1 Macro names [macro.names] 1 A translation unit that includes a standard library header shall not #define or #undef names declared in any standard library header. 2 A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 3, or to the attribute-tokens described in 7.6. so when including rte_common.h into a translation unit that is being compiled C++ the rte_common.h violates the standard by leaking the #define asm macro. this problem appears as soon as you try to build a C++ based dpdk application with clang using windows C++ runtime and #include <list>.