* [PATCH] cxgb4: Fix the -Wmisleading-indentation warning
@ 2020-11-04 5:24 xiakaixu1987
2020-11-05 19:58 ` Joe Perches
2020-11-07 19:56 ` Jakub Kicinski
0 siblings, 2 replies; 3+ messages in thread
From: xiakaixu1987 @ 2020-11-04 5:24 UTC (permalink / raw)
To: vishal, davem, kuba; +Cc: netdev, linux-kernel, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
Fix the gcc warning:
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:2673:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
2673 | for (i = 0; i < n; ++i) \
Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 0273f40b85f7..c24d34a937c8 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2671,7 +2671,7 @@ do { \
seq_printf(seq, "%-12s", s); \
for (i = 0; i < n; ++i) \
seq_printf(seq, " %16" fmt_spec, v); \
- seq_putc(seq, '\n'); \
+ seq_putc(seq, '\n'); \
} while (0)
#define S(s, v) S3("s", s, v)
#define T3(fmt_spec, s, v) S3(fmt_spec, s, tx[i].v)
--
2.20.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cxgb4: Fix the -Wmisleading-indentation warning
2020-11-04 5:24 [PATCH] cxgb4: Fix the -Wmisleading-indentation warning xiakaixu1987
@ 2020-11-05 19:58 ` Joe Perches
2020-11-07 19:56 ` Jakub Kicinski
1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2020-11-05 19:58 UTC (permalink / raw)
To: xiakaixu1987, vishal, davem, kuba; +Cc: netdev, linux-kernel, Kaixu Xia
On Wed, 2020-11-04 at 13:24 +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> Fix the gcc warning:
>
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:2673:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
> 2673 | for (i = 0; i < n; ++i) \
true, the defined macros though aren't pretty and depend on
externally defined i and n.
It'd be good to show that and to update the slightly difficult to read
helpers below that and remove the unnecessary T3 and R3 macros too.
Perhaps:
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 28 ++++++++++------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 0273f40b85f7..a7fddcdf4eac 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2666,20 +2666,20 @@ static int sge_qinfo_show(struct seq_file *seq, void *v)
if (r)
seq_putc(seq, '\n');
-#define S3(fmt_spec, s, v) \
-do { \
- seq_printf(seq, "%-12s", s); \
- for (i = 0; i < n; ++i) \
- seq_printf(seq, " %16" fmt_spec, v); \
- seq_putc(seq, '\n'); \
+/* These macros are dependent on locally scoped i and n variables */
+#define S3(fmt_spec, s, v) \
+do { \
+ seq_printf(seq, "%-12s", s); \
+ for (i = 0; i < n; ++i) \
+ seq_printf(seq, " %16" fmt_spec, v); \
+ seq_putc(seq, '\n'); \
} while (0)
-#define S(s, v) S3("s", s, v)
-#define T3(fmt_spec, s, v) S3(fmt_spec, s, tx[i].v)
-#define T(s, v) S3("u", s, tx[i].v)
-#define TL(s, v) T3("lu", s, v)
-#define R3(fmt_spec, s, v) S3(fmt_spec, s, rx[i].v)
-#define R(s, v) S3("u", s, rx[i].v)
-#define RL(s, v) R3("lu", s, v)
+
+#define S(s, v) S3("s", s, v)
+#define T(s, v) S3("u", s, tx[i].v)
+#define TL(s, v) S3("lu", s, tx[i].v)
+#define R(s, v) S3("u", s, rx[i].v)
+#define RL(s, v) S3("lu", s, rx[i].v)
if (r < eth_entries) {
int base_qset = r * 4;
@@ -3139,8 +3139,6 @@ do { \
#undef T
#undef TL
#undef S
-#undef R3
-#undef T3
#undef S3
out:
return 0;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cxgb4: Fix the -Wmisleading-indentation warning
2020-11-04 5:24 [PATCH] cxgb4: Fix the -Wmisleading-indentation warning xiakaixu1987
2020-11-05 19:58 ` Joe Perches
@ 2020-11-07 19:56 ` Jakub Kicinski
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-07 19:56 UTC (permalink / raw)
To: xiakaixu1987; +Cc: vishal, davem, netdev, linux-kernel, Kaixu Xia
On Wed, 4 Nov 2020 13:24:04 +0800 xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> Fix the gcc warning:
>
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:2673:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
> 2673 | for (i = 0; i < n; ++i) \
>
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-07 19:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-04 5:24 [PATCH] cxgb4: Fix the -Wmisleading-indentation warning xiakaixu1987
2020-11-05 19:58 ` Joe Perches
2020-11-07 19:56 ` Jakub Kicinski
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).