[PATCH] sscanf test failure when cross-compiling and running tests under Wine
Richard W.M. Jones
rjones at redhat.com
Wed Jan 28 17:46:22 CET 2009
The attached patch fixes a small test problem which was revealed when
cross-compiling libgmp 4.2.4 and then running the test suite under
Wine.
It is actually a bug (or feature) of Windows implementation of scanf,
which is that it doesn't skip whitespace before %-specifiers:
http://msdn.microsoft.com/en-us/library/kwwtf9ch(VS.71).aspx
Rich.
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 68 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
--- gmp-4.2.4.orig/tests/misc/t-scanf.c 2008-08-02 21:11:59.000000000 +0100
+++ gmp-4.2.4.sscanf/tests/misc/t-scanf.c 2009-01-28 16:42:26.000000000 +0000
@@ -93,6 +93,24 @@
return result;
}
+/* This is a problem found on i686-pc-mingw32, running binaries under
+ Wine. Windows scanf functions don't skip whitespace before %-specifiers
+ [http://msdn.microsoft.com/en-us/library/kwwtf9ch(VS.71).aspx] */
+int
+test_sscanf_s_skips_whitespace (void)
+{
+ char str[16];
+
+ if (sscanf (" ", "%s", str) == EOF)
+ return 1;
+ else
+ {
+ printf ("Warning, sscanf (\" \", \"%s\", str) != EOF.\n");
+ printf ("This affects gmp_sscanf, some tests will be suppressed.\n");
+ return 0;
+ }
+}
+
/* Convert fmt from a GMP scanf format string to an equivalent for a plain
libc scanf, for example "%Zd" becomes "%ld". Return 1 if this succeeds,
@@ -1489,6 +1507,7 @@
}
/* EOF for no matching */
+ if (test_sscanf_s_skips_whitespace ())
{
char buf[128];
ret = gmp_sscanf (" ", "%s", buf);
More information about the gmp-devel
mailing list