[dpdk-dev] [PATCH] headers: typeof -> __typeof__ to unbreak C++11 code

Simon Kågström simon.kagstrom at netinsight.net
Mon Mar 2 08:55:17 CET 2015


On 2015-02-27 17:24, Ananyev, Konstantin wrote:
> Actually, I wonder wouldn't something like the one below be sufficient?
> 
> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/
> index 8ac940c..1867692 100644
> --- a/lib/librte_eal/common/include/rte_common.h
> +++ b/lib/librte_eal/common/include/rte_common.h
> @@ -51,6 +51,15 @@ extern "C" {
>  #include <errno.h>
>  #include <limits.h>
> 
> +#ifndef typeof
> +#define typeof __typeof__
> +#endif
> +
> +#ifndef asm
> +#define asm __asm__
> +#endif

Yes, I've tested, and this works with g++ as well.

// Simon


More information about the dev mailing list