All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] cpuset: Work around a clang compiler warning
@ 2018-06-26 16:45 Alistair Strachan
  2018-06-27 16:01 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Alistair Strachan @ 2018-06-26 16:45 UTC (permalink / raw
  To: ltp

The clang compiler will warn about pasting a C string literal and an
int, suggesting that array indexing should be used instead:

testcases/kernel/controllers/cpuset/cpuset_lib/cpuinfo.c:143:3: error:
 adding 'int' to a string does not append to the string
 [-Werror,-Wstring-plus-int]
  while_each_childdir(SYS_CPU_DIR, "/", c_relpath,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
testcases/kernel/controllers/cpuset/cpuset_lib/common.h:54:13: note:
 expanded from macro 'while_each_childdir'
  p_relpath + start); \
  ~~~~~~~~~~^~~~~~~
testcases/kernel/controllers/cpuset/cpuset_lib/cpuinfo.c:143:3: note:
 use array indexing to silence this warning

This seems like a strange warning, but the suggestion has no effect on
code generation or readability, so change it to keep clang happy.

Signed-off-by: Alistair Strachan <astrachan@google.com>
---
 testcases/kernel/controllers/cpuset/cpuset_lib/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_lib/common.h b/testcases/kernel/controllers/cpuset/cpuset_lib/common.h
index bd347413c..28e948e63 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_lib/common.h
+++ b/testcases/kernel/controllers/cpuset/cpuset_lib/common.h
@@ -51,7 +51,7 @@
 		start = 1;						\
 									\
 	snprintf(fullpath, sizeof(fullpath), "%s%s", basepath,		\
-		p_relpath + start);					\
+		 &p_relpath[start]);					\
 	pathlen = strlen(fullpath);					\
 									\
 	if ((dp = opendir(fullpath)) == NULL)				\

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

* [LTP] [PATCH] cpuset: Work around a clang compiler warning
  2018-06-26 16:45 [LTP] [PATCH] cpuset: Work around a clang compiler warning Alistair Strachan
@ 2018-06-27 16:01 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2018-06-27 16:01 UTC (permalink / raw
  To: ltp

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2018-06-27 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 16:45 [LTP] [PATCH] cpuset: Work around a clang compiler warning Alistair Strachan
2018-06-27 16:01 ` Cyril Hrubis

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.