From: Bruce Richardson <bruce.richardson@intel.com>
To: Andre Muezerie <andremue@linux.microsoft.com>
Cc: Jingjing Wu <jingjing.wu@intel.com>,
Praveen Shetty <praveen.shetty@intel.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, <dev@dpdk.org>
Subject: Re: [PATCH 1/2] drivers/common: remove unused variables and add MSVC compiler flag
Date: Mon, 6 Jan 2025 10:50:33 +0000 [thread overview]
Message-ID: <Z3u1eTuAkSJKbqbu@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <1735238504-15597-2-git-send-email-andremue@linux.microsoft.com>
On Thu, Dec 26, 2024 at 10:41:43AM -0800, Andre Muezerie wrote:
> Removed unused variables and added MSVC specific compiler flag to
> ignore warnings about unused variables, like is being done for
> other compilers.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---
> drivers/common/idpf/base/meson.build | 13 ++++++++++---
> drivers/common/idpf/idpf_common_rxtx.c | 2 --
> drivers/common/idpf/idpf_common_virtchnl.c | 4 ++--
> drivers/common/sfc_efx/base/efx_mae.c | 2 +-
> drivers/common/sfc_efx/base/efx_table.c | 1 -
> drivers/common/sfc_efx/base/meson.build | 20 +++++++++++++-------
> 6 files changed, 26 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/common/idpf/base/meson.build b/drivers/common/idpf/base/meson.build
> index f30ec7dfc2..c069507f12 100644
> --- a/drivers/common/idpf/base/meson.build
> +++ b/drivers/common/idpf/base/meson.build
> @@ -6,9 +6,16 @@ sources += files(
> 'idpf_controlq_setup.c',
> )
>
> -error_cflags = [
> - '-Wno-unused-variable',
> -]
> +if is_ms_compiler
> + error_cflags = [
> + '/wd4101', # unreferenced local variable
> + ]
Just an idea here, since I see this same flag with the same constant
appearing multiple times in the patches: Would it be worthwhile defining
these MSVC flags as global strings in meson e.g. in a file in the "config"
directory. That would then allow them to put in the flags array using
meaningful names, and avoid the need for putting in the same comment each
time.
if is_ms_compiler
error_cflags = [
msvc_no_unref_local_var
]
If we want to take this a step further, we could define all common error
flags across all compilers this way, so that we avoid the need for
conditional in each individual meson.build file - we just define the names
of the errors we want and let the string replacement handle the conversion
to the appropriate compiler flag. The names could be, for example, the
gcc/clang error names without the "-W" bit. If no MSVC equivalent they
could be empty strings in those builds.
WDYT?
/Bruce
next prev parent reply other threads:[~2025-01-06 10:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-26 18:41 [PATCH 0/2] " Andre Muezerie
2024-12-26 18:41 ` [PATCH 1/2] drivers/common: " Andre Muezerie
2025-01-06 10:50 ` Bruce Richardson [this message]
2024-12-26 18:41 ` [PATCH 2/2] drivers/net: " Andre Muezerie
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=Z3u1eTuAkSJKbqbu@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=andremue@linux.microsoft.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=praveen.shetty@intel.com \
/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).