Add sysdeps/ieee754/soft-fp.
[glibc.git] / wcsmbs / tst-wcstof.c
blob5b7cdeacd8896b947872e4d8a3d56978e95c9ef0
1 #define _GNU_SOURCE 1
2 #include <wchar.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <wctype.h>
6 #include <libc-diag.h>
8 static int
9 do_test (void)
11 int result = 0;
12 char buf[100];
13 wchar_t tmp[3];
14 tmp[0] = '8';
15 tmp[1] = '1';
16 tmp[2] = 0;
18 /* GCC does not know the result of wcstof so cannot see that the
19 snprintf output is not truncated. */
20 DIAG_PUSH_NEEDS_COMMENT;
21 #if __GNUC_PREREQ (7, 0)
22 DIAG_IGNORE_NEEDS_COMMENT (7.0, "-Wformat-truncation");
23 #endif
24 snprintf (buf, 100, "%S = %f", tmp, wcstof (tmp, NULL));
25 DIAG_POP_NEEDS_COMMENT;
26 printf ("\"%s\" -> %s\n", buf,
27 strcmp (buf, "81 = 81.000000") == 0 ? "okay" : "buggy");
28 result |= strcmp (buf, "81 = 81.000000") != 0;
30 return result;
33 #include <support/test-driver.c>