From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 2A07D385840B; Tue, 4 Oct 2022 13:02:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A07D385840B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664888574; bh=Y81OqLME6j0reMeytOfhVfQ35ZG1WcT6EkScAiSHZ7Y=; h=From:To:Subject:Date:From; b=h3EDjNGXQkCxEOiMg9fO7ityFzKKBGp/EoeDjCwt57RqS2VKl5x2ssP0OcloNQolL flZTscqjjM6WUn7FWxemW8lFye4FDDWwK82tYXFQb6kUBpRwpi54ur5nehcXv76nHh SygpzCZnQ1A9L5NmGZzu0jz+UYeZ4rmUZ98icL2s= 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: 701018065d2fa074a274650e8c637dc87d51a149 X-Git-Newrev: 8a43f21a9a3c548a6c30a9e249ec1e61c4174010 Message-Id: <20221004130254.2A07D385840B@sourceware.org> Date: Tue, 4 Oct 2022 13:02:54 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8a43f21a9a3c548a6c30a9e249ec1e61c4174010 commit 8a43f21a9a3c548a6c30a9e249ec1e61c4174010 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 648a990e9c..b3cbb866ce 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)