diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-01-08 13:01:36 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-01-08 20:07:24 +0100 |
commit | 2b3aa44656dd873e2753c98fdcb95be6a9d147a6 (patch) | |
tree | 7c6df54631968d08cc407487b20b93c5123baac6 /ChangeLog | |
parent | 630f4cc3aa019ede55976ea561f1a7af2f068639 (diff) | |
download | glibc-2b3aa44656dd873e2753c98fdcb95be6a9d147a6.tar glibc-2b3aa44656dd873e2753c98fdcb95be6a9d147a6.tar.gz glibc-2b3aa44656dd873e2753c98fdcb95be6a9d147a6.tar.bz2 glibc-2b3aa44656dd873e2753c98fdcb95be6a9d147a6.zip |
support: Increase usability of TEST_COMPARE
The previous implementation of the TEST_COMPARE macro would fail
to compile code like this:
int ret = res_send (query, sizeof (query), buf, sizeof (buf));
TEST_COMPARE (ret,
sizeof (query)
+ 2 /* Compression reference. */
+ 2 + 2 + 4 + 2 /* Type, class, TTL, RDATA length. */
+ 1 /* Pascal-style string length. */
+ strlen (expected_name));
This resulted in a failed static assertion, "integer conversions
may alter sign of operands". A user of the TEST_COMPARE would have
to add a cast to fix this.
This patch reverts to the original proposed solution of a run-time
check, making TEST_COMPARE usable for comparisons of numbers with
types with different signedness in more contexts.
Diffstat (limited to 'ChangeLog')
-rw-r--r-- | ChangeLog | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1,3 +1,15 @@ +2018-01-08 Florian Weimer <fweimer@redhat.com> + + * support/check.h (TEST_COMPARE): Allow sign mismatch at compile + time. Pass positive flag instead of negative flag to + support_test_compare_failure. + (support_test_compare_failure): Change negative parameter to + positive. + * support/support_test_compare_failure.c (report) + (support_test_compare_failure): Likewise. + * support/tst-test_compare.c (return_ssize_t, return_int): New. + (do_test): Check int/size_t, ssize_t/size_t comparisons. + 2018-01-08 Szabolcs Nagy <szabolcs.nagy@arm.com> [BZ #22637] |