From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 4C88D385841C; Wed, 30 Aug 2023 12:40:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C88D385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693399201; bh=NiybkRYxziGbWDH7C3vySpK+b4ZNQ6CKCMSHR2xBBJA=; h=From:To:Subject:Date:From; b=ToWb8BegJgh2lHqOcb+nfw6bihYuFtZ9l1bCGzCWZZKxGblVHgi450Ia5SwCL5yAm RT54te6QP24nJK8I1RAVqHOWL17cTheC6EE9uoKIDnifm2ULHeg8uyfgvcgdvClHJ4 eALcUggnEr1h+S3gSWMbecX2wDYGVzWrZoJCldXM= 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: 7c7b84ea80b7cea9ff36ee40eb372cde9b304f86 X-Git-Newrev: 9b486d234d0ea37d6613f68e99a433551cc06f72 Message-Id: <20230830124001.4C88D385841C@sourceware.org> Date: Wed, 30 Aug 2023 12:40:01 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9b486d234d0ea37d6613f68e99a433551cc06f72 commit 9b486d234d0ea37d6613f68e99a433551cc06f72 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 08c2c71ef5..a6d7864f81 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)