This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 02/11] ldbl-128ibm-compat: Add ISO C99 versions of scanf functions




On 12/3/19 11:05 AM, Gabriel F. T. Gomes wrote:
From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>

Changes since v2:

   - Removed ugly hacks after rebase against commit ID 93486ba583ec.
   - Updated copyright years.
   - Unified test case for GNU and ISO C99 versions (got rid of many
     files in the process, including the new test template for C99).
   - Fixed http URLs.
   - Updated commit message.

No changes since v1.

-- 8< --
In the format string for *scanf functions, the '%as', '%aS', and '%a[]'
modifiers behave differently depending on ISO C99 compatibility.  When
_GNU_SOURCE is defined and -std=c89 is passed to the compiler, these
functions behave like ascanf, and the modifiers allocate memory for the
output.  Otherwise, the ISO C99 compliant version of these functions is
used, and the modifiers consume a floating-point argument.  This patch
adds the IEEE binary128 variant of ISO C99 compliant functions for the
third long double format on powerpc64le.

Tested for powerpc64le.

Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>


diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c
index 3dbed79b68..9bdf6daa0b 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c

...

+  /* For ISO C99, scan the single-precision value with "%as" to test
+     that __isoc99_*scanf ignores the 's'.  For DEPRECATED_SCANF, do not
+     use "%as", because that would try to scan a string and allocate
+     space for it.  */
+#if __GLIBC_USE (DEPRECATED_SCANF)
+# define FMT "%La %a"
+#else
+# define FMT "%La %as"
+#endif

That does simplify the patch nicely.  LGTM.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]