[PATCH v2] Add pragma to ignore gcc-compat warnings in clang when used with diagnose_if.
Michael Barker
mikeb01 at gmail.com
Sun Jan 23 22:17:37 CET 2022
On Fri, 21 Jan 2022 at 03:16, Thomas Monjalon <thomas at monjalon.net> wrote:
> 18/01/2022 00:23, Michael Barker:
> > When using clang with -Wall the use of diagnose_if kicks up a warning,
>
> Please could you copy the warning in the commit log?
>
I've updated the commit log to be more descriptive (and included the
associated warning).
> requiring all dpdk includes to be wrapped with the pragma. This change
> > isolates the ignore just the appropriate location and makes it easier
> > for users to apply -Wall,-Werror
>
> Please could you explain how it is related to -Wgcc-compat?
>
I'm currently working on some code that makes use of DPDK, which is built
with '-Wall,-Werror' enabled. When using the clang toolchain the build
fails as a result of this macro that this patch updates. The workaround
from my application is to wrap all of the DPDK header includes in pragma to
disable the warnings (see below). This has the unfortunate side effect of
disabling this warning across all of the included DPDK headers, which is
not ideal. Hence the reason to submit the patch which disables the warning
just in the location where it occurs.
#if defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgcc-compat"
#endif
#include <rte_ethdev.h>
#if defined(__clang__)
#pragma GCC diagnostic pop "-Wgcc-compat"
#endif
>
> [...]
> > #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")
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20220124/1072247d/attachment.htm>
More information about the dev
mailing list