* [PATCH ethtool 1/1] netlink/rss: move variable declaration out of the for loop
@ 2023-05-22 16:17 Dario Binacchi
2023-05-22 16:37 ` Kuniyuki Iwashima
2023-05-22 17:31 ` Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Dario Binacchi @ 2023-05-22 16:17 UTC (permalink / raw)
To: netdev; +Cc: Michal Kubecek, Sudheer Mogilappagari, Dario Binacchi
The patch fixes this compilation error:
netlink/rss.c: In function 'rss_reply_cb':
netlink/rss.c:166:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
^
netlink/rss.c:166:3: note: use option -std=c99 or -std=gnu99 to compile your code
The project doesn't really need a C99 compiler, so let's move the variable
declaration outside the for loop.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
| 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--git a/netlink/rss.c b/netlink/rss.c
index 4ad6065ef698..a4a72e83fcf0 100644
--- a/netlink/rss.c
+++ b/netlink/rss.c
@@ -92,7 +92,7 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
u8 *hkey = NULL;
bool silent;
int err_ret;
- int ret;
+ int i, ret;
silent = nlctx->is_dump || nlctx->is_monitor;
err_ret = silent ? MNL_CB_OK : MNL_CB_ERROR;
@@ -163,7 +163,7 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
printf(" Operation not supported\n");
return 0;
}
- for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
+ for (i = 0; i < get_count(hash_funcs); i++) {
printf(" %s: %s\n", get_string(hash_funcs, i),
(rss_hfunc & (1 << i)) ? "on" : "off");
}
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH ethtool 1/1] netlink/rss: move variable declaration out of the for loop
2023-05-22 16:17 [PATCH ethtool 1/1] netlink/rss: move variable declaration out of the for loop Dario Binacchi
@ 2023-05-22 16:37 ` Kuniyuki Iwashima
2023-05-22 17:31 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2023-05-22 16:37 UTC (permalink / raw)
To: dario.binacchi; +Cc: mkubecek, netdev, sudheer.mogilappagari, kuniyu
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Date: Mon, 22 May 2023 18:17:10 +0200
> The patch fixes this compilation error:
>
> netlink/rss.c: In function 'rss_reply_cb':
> netlink/rss.c:166:3: error: 'for' loop initial declarations are only allowed in C99 mode
> for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
> ^
> netlink/rss.c:166:3: note: use option -std=c99 or -std=gnu99 to compile your code
>
> The project doesn't really need a C99 compiler, so let's move the variable
> declaration outside the for loop.
>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
> netlink/rss.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/netlink/rss.c b/netlink/rss.c
> index 4ad6065ef698..a4a72e83fcf0 100644
> --- a/netlink/rss.c
> +++ b/netlink/rss.c
> @@ -92,7 +92,7 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
> u8 *hkey = NULL;
> bool silent;
> int err_ret;
> - int ret;
> + int i, ret;
'i' was 'unsigned int' and get_count() returns unsigned int.
>
> silent = nlctx->is_dump || nlctx->is_monitor;
> err_ret = silent ? MNL_CB_OK : MNL_CB_ERROR;
> @@ -163,7 +163,7 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
> printf(" Operation not supported\n");
> return 0;
> }
> - for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
> + for (i = 0; i < get_count(hash_funcs); i++) {
> printf(" %s: %s\n", get_string(hash_funcs, i),
> (rss_hfunc & (1 << i)) ? "on" : "off");
> }
> --
> 2.32.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH ethtool 1/1] netlink/rss: move variable declaration out of the for loop
2023-05-22 16:17 [PATCH ethtool 1/1] netlink/rss: move variable declaration out of the for loop Dario Binacchi
2023-05-22 16:37 ` Kuniyuki Iwashima
@ 2023-05-22 17:31 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2023-05-22 17:31 UTC (permalink / raw)
To: Dario Binacchi; +Cc: netdev, Michal Kubecek, Sudheer Mogilappagari
On Mon, 22 May 2023 18:17:10 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:
> The patch fixes this compilation error:
>
> netlink/rss.c: In function 'rss_reply_cb':
> netlink/rss.c:166:3: error: 'for' loop initial declarations are only allowed in C99 mode
> for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
> ^
> netlink/rss.c:166:3: note: use option -std=c99 or -std=gnu99 to compile your code
>
> The project doesn't really need a C99 compiler, so let's move the variable
> declaration outside the for loop.
>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
But you changed the type which will now cause signed/unsigned warnings.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-22 17:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22 16:17 [PATCH ethtool 1/1] netlink/rss: move variable declaration out of the for loop Dario Binacchi
2023-05-22 16:37 ` Kuniyuki Iwashima
2023-05-22 17:31 ` Stephen Hemminger
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).