From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 428AEA04A7; Sun, 23 Jan 2022 22:17:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBBD2427A1; Sun, 23 Jan 2022 22:17:50 +0100 (CET) Received: from mail-vk1-f171.google.com (mail-vk1-f171.google.com [209.85.221.171]) by mails.dpdk.org (Postfix) with ESMTP id 8119640040 for ; Sun, 23 Jan 2022 22:17:49 +0100 (CET) Received: by mail-vk1-f171.google.com with SMTP id w5so8924145vke.12 for ; Sun, 23 Jan 2022 13:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SMGZbTsWOKfuxqbtmQLeiaMBzdNrtm1/d9jUlbeQqGg=; b=XgdGEGsmlGxxEZ/1dUaHtneBoJGuuxadXHiKz8fpWrXxrSxIENLvrG8/S0yW//SmSF 9GaHT/O1D253e6oEdzajOtKJC+lspJXe4jU9CbkjGVy3ubX1GNiUxI1cMD9vrTZv2QlX 4F/2F2l8KBuiOrJUg+UmvC0ZsxZ3IdFvELns2rMM8/EnLV5z4R/M3Yuv9nog6/cJgsXh vBAM8S0BmtL0rylB7o9GfpwHfaWbvEgyhZD7NWapvVaE89gyuiwamvhRnLFKyC/44Ndl 89xtsgYOtk1J6XOtojh9jH0QpwdGC3AY2aeLbMlIxNoSycAieby47mmAvMLgZcgg+UVs W8Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SMGZbTsWOKfuxqbtmQLeiaMBzdNrtm1/d9jUlbeQqGg=; b=za3RxwyW7e8CJIiJ4gjTHHqt/f7WLD9xnfipunCvapeOk+egNkGHhdbfU/PxSX/Gaf Xz6USfa8zJkIxZI8epP5WWT/X7mhGTEjjbm9bcucAoMIZnJq27ai94ujlc14mjgXFjPD dLIYMZ232xoiuibnvD37lUW7VjqKg0MAfitpuX94s7S0y/AmOI8D2CNJhQmosI8bXSyt ts28XkEwuhzSHi8OwXcVfR11jYAlbGmW/vhPT/VFwTeDZuR+C3jpSwqdqwacsjJc7de1 YyphXpJ6uGOp/pvUYsZltuisrtZL7fg6ei2AWB++edT7ZRzGKy9N4o3lmNDNIcUJXUQj UDaA== X-Gm-Message-State: AOAM532HR/rkk8ds5qIWtIx4SfEi6dMOrSxagGHmS/R8pTCKq8qk+agG y4mDDTBnTx0rKFPVwfpW8bz7UJjFXM37S6FIiDmoxfOPtKWt2Q== X-Google-Smtp-Source: ABdhPJwrs7Z5gpZuGxFgjyLeVz0OQj7Kcx/qLR93EDeO9NFx4ifPUYo2w/Nkmc2eSDsesWmWKIK4W147eokZkU+4z4M= X-Received: by 2002:a05:6122:510:: with SMTP id x16mr1723961vko.4.1642972668730; Sun, 23 Jan 2022 13:17:48 -0800 (PST) MIME-Version: 1.0 References: <20220117231404.219496-1-mikeb01@gmail.com> <20220117232318.219749-1-mikeb01@gmail.com> <10018405.DAOxP5AVGn@thomas> In-Reply-To: <10018405.DAOxP5AVGn@thomas> From: Michael Barker Date: Mon, 24 Jan 2022 10:17:37 +1300 Message-ID: Subject: Re: [PATCH v2] Add pragma to ignore gcc-compat warnings in clang when used with diagnose_if. To: Thomas Monjalon Cc: dev@dpdk.org, Ray Kinsella Content-Type: multipart/alternative; boundary="0000000000004ba14a05d64662cd" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --0000000000004ba14a05d64662cd Content-Type: text/plain; charset="UTF-8" On Fri, 21 Jan 2022 at 03:16, Thomas Monjalon 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 #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") > > > > --0000000000004ba14a05d64662cd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, 21 Jan 2022 at 03:16, Thomas Monjalon <<= a href=3D"mailto:thomas@monjalon.net">thomas@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?
<= br>
I'= ve updated the commit log to be more descriptive (and included the associat= ed warning).

> requiring all dpdk includes to be wrapped with the pragma.=C2=A0 This = change
> isolates the ignore just the appropriate location and makes it easier<= br> > 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 bu= ilt with '-Wall,-Werror' enabled.=C2=A0 When using the clang toolch= ain the build fails as a result of this macro that this patch updates.=C2= =A0 The workaround from my application is to wrap all of the DPDK header in= cludes in pragma to disable the warnings (see below).=C2=A0 This has the un= fortunate side effect of disabling this warning across all of the included = DPDK headers, which is not ideal.=C2=A0 Hence the reason to submit the patc= h which disables the warning just in the location where it occurs.

#if defined(__=
clang__)
#pragma GCC diagnost= ic push
#pragma GCC diagnosti= c ignored "= ;-Wgcc-compat"
#endif#include <rte_ethdev.h>
#if defined(__clang__)
#pragma GCC diagnostic pop "-Wgcc-compat"
#endif
=C2=A0
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
[...]
>=C2=A0 #define __rte_internal \
> +_Pragma("GCC diagnostic push") \
> +_Pragma("GCC diagnostic ignored \"-Wgcc-compat\""= ) \
>=C2=A0 __attribute__((diagnose_if(1, "Symbol is not public ABI&quo= t;, "error"), \
> -section(".text.internal")))
> +section(".text.internal"))) \
> +_Pragma("GCC diagnostic pop")



--0000000000004ba14a05d64662cd--