aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@redhat.com>2025-08-23 01:02:10 +0100
committerMaciej W. Rozycki <macro@redhat.com>2025-08-23 01:02:46 +0100
commitaa4dbb2eebf7b047689f5fbad7fe58ae5434a72c (patch)
tree154fef3601aaab1a2786860a8c569759ea29db28 /sysdeps
parenta1e5ee13ab9b786f291c8f55f93db11be1ae286c (diff)
downloadglibc-aa4dbb2eebf7b047689f5fbad7fe58ae5434a72c.zip
glibc-aa4dbb2eebf7b047689f5fbad7fe58ae5434a72c.tar.gz
glibc-aa4dbb2eebf7b047689f5fbad7fe58ae5434a72c.tar.bz2
stdio-common: Convert macros across scanf input specifier tests
Convert 'compare_real', 'read_real', and 'verify_input' macros to functions so as to improve readability and avoid pitfalls. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/ldbl-96/tst-scanf-format-skeleton-ldouble.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sysdeps/ieee754/ldbl-96/tst-scanf-format-skeleton-ldouble.c b/sysdeps/ieee754/ldbl-96/tst-scanf-format-skeleton-ldouble.c
index 79903cc..a2f598e 100644
--- a/sysdeps/ieee754/ldbl-96/tst-scanf-format-skeleton-ldouble.c
+++ b/sysdeps/ieee754/ldbl-96/tst-scanf-format-skeleton-ldouble.c
@@ -17,19 +17,21 @@
<https://www.gnu.org/licenses/>. */
#include <math_ldbl.h>
+#include <stdbool.h>
#include <stdint.h>
#include <string.h>
typedef long double type_t;
-#include "tst-scanf-format-real.h"
+static bool
+compare_real (type_t x, type_t y)
+{
+ ieee_long_double_shape_type ux = { .value = x }, uy = { .value = y };
-#undef compare_real
-#define compare_real(x, y) \
-({ \
- ieee_long_double_shape_type ux = { .value = x }, uy = { .value = y }; \
- (ux.parts.lsw == uy.parts.lsw && ux.parts.msw == uy.parts.msw \
- && ux.parts.sign_exponent == uy.parts.sign_exponent); \
-})
+ return (ux.parts.lsw == uy.parts.lsw && ux.parts.msw == uy.parts.msw
+ && ux.parts.sign_exponent == uy.parts.sign_exponent);
+}
+#define compare_real compare_real
+#include "tst-scanf-format-real.h"
#include "tst-scanf-format-skeleton.c"