All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] include/trace/events/wbt.h: Suppress a compiler warning
@ 2018-06-27 20:22 Bart Van Assche
  2018-06-29  8:34 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2018-06-27 20:22 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Bart Van Assche

This patch avoids that the following warning appears when building
with gcc 8 and W=1:

./include/trace/events/wbt.h:36:3: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 include/trace/events/wbt.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/trace/events/wbt.h b/include/trace/events/wbt.h
index b048694070e2..29ec58adfddd 100644
--- a/include/trace/events/wbt.h
+++ b/include/trace/events/wbt.h
@@ -8,6 +8,9 @@
 #include <linux/tracepoint.h>
 #include "../../../block/blk-wbt.h"
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+
 /**
  * wbt_stat - trace stats for blk_wb
  * @stat: array of read/write stats
@@ -148,6 +151,8 @@ TRACE_EVENT(wbt_timer,
 		  __entry->status, __entry->step, __entry->inflight)
 );
 
+#pragma GCC diagnostic pop
+
 #endif /* _TRACE_WBT_H */
 
 /* This part must be outside protection */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] include/trace/events/wbt.h: Suppress a compiler warning
  2018-06-27 20:22 [PATCH] include/trace/events/wbt.h: Suppress a compiler warning Bart Van Assche
@ 2018-06-29  8:34 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2018-06-29  8:34 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Jens Axboe, linux-block, Christoph Hellwig

On Wed, Jun 27, 2018 at 01:22:34PM -0700, Bart Van Assche wrote:
> This patch avoids that the following warning appears when building
> with gcc 8 and W=1:
> 
> ./include/trace/events/wbt.h:36:3: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]

I really don't think this is the right fix.  Note that the trace
code allows for dynamic arrays using __dynamic_array(), so the best idea
might be to switch to that.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-29  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-27 20:22 [PATCH] include/trace/events/wbt.h: Suppress a compiler warning Bart Van Assche
2018-06-29  8:34 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.