From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id DF0873858413; Mon, 29 Jan 2024 18:00:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF0873858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706551254; bh=xp9xRUdmzSauFc8D7V92e2uHlCKiKX0/CkRbvxFpFp8=; h=From:To:Subject:Date:From; b=XyVPX2uPzSrymMTzLTjFSv0OmG35EO/8S9j4AyFOpwMp6Ju2p1CZVK9gpKJe/ZcU2 9gOP5G6+fF4GqctstAf4f+wvVel8n7cvDGqRS4yU13BI/DqAOAZ3zwhW+BUdmXWGcA Vp+444kizOa4x4xe0u3Cq5Bgpb869nhGHygau/7E= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] support: Suppress clang warning on tst-timespec X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: c02eeebe930d9c3e3c3932eaf6bafdf3fe0df346 X-Git-Newrev: a28664caff3ecdecdc3ea1ed586f2f866318a506 Message-Id: <20240129180054.DF0873858413@sourceware.org> Date: Mon, 29 Jan 2024 18:00:54 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a28664caff3ecdecdc3ea1ed586f2f866318a506 commit a28664caff3ecdecdc3ea1ed586f2f866318a506 Author: Adhemerval Zanella Date: Fri Mar 25 11:26:46 2022 -0300 support: Suppress clang warning on tst-timespec clang warns that converting from TIME_T_MAX to double (upper_bound) loses precision (from 9223372036854775807 to 9223372036854775808): tst-timespec.c:290:19: error: implicit conversion from 'time_t' (aka 'long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion] .upper_bound = TIME_T_MAX, .lower_bound = 1, .result = 1, ^~~~~~~~~~ tst-timespec.c:48:20: note: expanded from macro 'TIME_T_MAX' #define TIME_T_MAX TYPE_MAXIMUM (time_t) ^~~~~~~~~~~~~~~~~~~~~ ../include/intprops.h:57:4: note: expanded from macro 'TYPE_MAXIMUM' ((t) (! TYPE_SIGNED (t) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It does not matter for the test. Checked on x86_64-linux-gnu. Diff: --- support/tst-timespec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/support/tst-timespec.c b/support/tst-timespec.c index 66fc42c03d..d622e741ec 100644 --- a/support/tst-timespec.c +++ b/support/tst-timespec.c @@ -20,6 +20,7 @@ #include #include #include +#include #define TIMESPEC_HZ 1000000000 @@ -179,6 +180,11 @@ struct timespec_norm_test_case norm_cases[] = { } }; +/* clang warns that converting from TIME_T_MAX to double (upper_bound) + loses precision (from 9223372036854775807 to 9223372036854775808). + It does not matter in tests below. */ +DIAG_PUSH_NEEDS_COMMENT_CLANG; +DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wimplicit-const-int-float-conversion"); /* Test cases for timespec_check_in_range */ struct timespec_test_case check_cases[] = { /* 0 - In range */ @@ -290,6 +296,7 @@ struct timespec_test_case check_cases[] = { .upper_bound = TIME_T_MAX, .lower_bound = 1, .result = 1, }, }; +DIAG_POP_NEEDS_COMMENT_CLANG; static int do_test (void)