Michael Barker <mike...@gmail.com> writes:
> When compiling with clang using -Wall (or -Wgcc-compat) the use of > diagnose_if kicks up a warning: > > .../include/rte_interrupts.h:623:1: error: 'diagnose_if' is a clang > extension [-Werror,-Wgcc-compat] > __rte_internal > ^ > .../include/rte_compat.h:36:16: note: expanded from macro '__rte_internal' > __attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \ > > This change ignores the '-Wgcc-compat' warning in the specific location > where the warning occurs. It is safe to do in this circumstance as the > specific macro is only defined when using the clang compiler. > > Signed-off-by: Michael Barker <mike...@gmail.com> > --- > lib/eal/include/rte_compat.h | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/include/rte_compat.h b/lib/eal/include/rte_compat.h > index 2718612cce..9556bbf4d0 100644 > --- a/lib/eal/include/rte_compat.h > +++ b/lib/eal/include/rte_compat.h > @@ -33,8 +33,11 @@ section(".text.internal"))) > #elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* > For clang */ Why doesn't the __has_attribute take care of this? I would have thought that gcc would check the for the attribute, find it doesn't support it and ignore the whole thing? > > #define __rte_internal \ > +_Pragma("GCC diagnostic push") \ > +_Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \ > __attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \ > -section(".text.internal"))) > +section(".text.internal"))) \ > +_Pragma("GCC diagnostic pop") > > #else -- Regards, Ray K