[CRIU] [PATCH 09/23] inotify_system tests: fix for clang
Kir Kolyshkin
kir at openvz.org
Tue Oct 11 18:46:47 PDT 2016
When compiling with clang, it complains like this:
> clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -iquote ../lib/arch/x86/include -I../lib inotify_system.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -o inotify_system
> inotify_system.c:323:50: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
> if ((common_desc.inot < 0) || (common_desc.file < 0) || \
> ~~~~~~~~~~~~~~~~ ^ ~
> inotify_system.c:324:21: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
> (common_desc.dir < 0) || (common_desc.link < 0)) {
> ~~~~~~~~~~~~~~~ ^ ~
> inotify_system.c:324:47: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
> (common_desc.dir < 0) || (common_desc.link < 0)) {
> ~~~~~~~~~~~~~~~~ ^ ~
> 3 errors generated.
Indeed these fields are uint32_t. As they are used to store the results of
inotify_init() and inotify_add_watch() function calls, the type should be int.
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
test/zdtm/static/inotify_system.c | 6 +++---
test/zdtm/static/inotify_system_nodel.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/test/zdtm/static/inotify_system.c b/test/zdtm/static/inotify_system.c
index 6841199..59f47c4 100644
--- a/test/zdtm/static/inotify_system.c
+++ b/test/zdtm/static/inotify_system.c
@@ -63,9 +63,9 @@ const char *inot_dir = "./inotify.nodel";
typedef struct {
int inot;
- uint32_t file;
- uint32_t link;
- uint32_t dir;
+ int file;
+ int link;
+ int dir;
} desc;
void do_wait() {
diff --git a/test/zdtm/static/inotify_system_nodel.c b/test/zdtm/static/inotify_system_nodel.c
index 4633f7c..ab4f5d1 100644
--- a/test/zdtm/static/inotify_system_nodel.c
+++ b/test/zdtm/static/inotify_system_nodel.c
@@ -63,9 +63,9 @@ const char *inot_dir = "./inotify.nodel";
typedef struct {
int inot;
- uint32_t file;
- uint32_t link;
- uint32_t dir;
+ int file;
+ int link;
+ int dir;
} desc;
void do_wait() {
--
2.7.4
More information about the CRIU
mailing list