From aa4dbb2eebf7b047689f5fbad7fe58ae5434a72c Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Sat, 23 Aug 2025 01:02:10 +0100 Subject: 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 --- .../ldbl-96/tst-scanf-format-skeleton-ldouble.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'sysdeps') 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 @@ . */ #include +#include #include #include 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" -- cgit v1.1