[CRIU] [PATCH 12/23] rtc.c test: fix for clang

Kir Kolyshkin kir at openvz.org
Tue Oct 11 18:46:50 PDT 2016


clang complains:
> clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -iquote ../lib/arch/x86/include -I../lib   rtc.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -o rtc
> rtc.c:50:7: error: taking the absolute value of unsigned type 'unsigned long' has no effect [-Werror,-Wabsolute-value]
>                 if (labs(delta - 1000000 / TEST_HZ ) > 100000) {
>                     ^

Declare delta as long.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 test/zdtm/static/rtc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/zdtm/static/rtc.c b/test/zdtm/static/rtc.c
index e082edc..28a79b1 100644
--- a/test/zdtm/static/rtc.c
+++ b/test/zdtm/static/rtc.c
@@ -15,7 +15,8 @@
 
 int main(int argc, char **argv)
 {
-	unsigned long data, delta;
+	unsigned long data;
+	long delta;
 	int fd, fail = NR_FAILS, to_pass = NR_FAILS;
 	struct timeval start, end;
 
-- 
2.7.4



More information about the CRIU mailing list