DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ray Kinsella <mdr@ashroe.eu>
To: Michael Barker <mikeb01@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org
Subject: Re: [PATCH v4] Add pragma to ignore gcc-compat warnings in clang when used with diagnose_if.
Date: Tue, 25 Jan 2022 05:33:06 -0500	[thread overview]
Message-ID: <87h79srtp9.fsf@mdr78.vserver.site> (raw)
In-Reply-To: <20220123212024.19747-1-mikeb01@gmail.com>


Michael Barker <mikeb01@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 <mikeb01@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

  parent reply	other threads:[~2022-01-25 10:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 23:14 [PATCH] " Michael Barker
2022-01-17 23:23 ` [PATCH v2] " Michael Barker
2022-01-20 14:16   ` Thomas Monjalon
2022-01-23 21:17     ` Michael Barker
2022-01-23 23:53       ` Stephen Hemminger
2022-01-23 21:07   ` [PATCH v3] " Michael Barker
2022-01-23 21:20     ` [PATCH v4] " Michael Barker
2022-01-23 23:55       ` Stephen Hemminger
2022-01-31  0:08         ` Michael Barker
2022-01-25 10:33       ` Ray Kinsella [this message]
2022-01-31  0:10         ` Michael Barker
2022-01-31  0:05       ` [PATCH v5] " Michael Barker
2022-02-12 14:00         ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h79srtp9.fsf@mdr78.vserver.site \
    --to=mdr@ashroe.eu \
    --cc=dev@dpdk.org \
    --cc=mikeb01@gmail.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).