mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 13:30:06 +00:00
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.
This commit is contained in:
parent
95458b5142
commit
56765bcfde
@ -20,6 +20,7 @@
|
||||
#include <support/check.h>
|
||||
#include <limits.h>
|
||||
#include <intprops.h>
|
||||
#include <libc-diag.h>
|
||||
|
||||
#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)
|
||||
|
Loading…
Reference in New Issue
Block a user