cpuset: Work around a clang compiler warning
PATCH 1/1 cpuset: Work around a clang compiler warning
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.
--- testcases/kernel/controllers/cpuset/cpuset_lib/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/cpuset/cpuset_lib/common.h +1 -1
@@ -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 ) \
PATCH 1/1 cpuset: Work around a clang compiler warning
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]