1 /* Test for the behaviour of 'is_long_double' in printf_size.
2    Copyright (C) 2018-2022 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #include <printf.h>
20 #include <stdio.h>
21 #include <string.h>
22 
23 #include <support/check.h>
24 
25 static int
do_test(void)26 do_test (void)
27 {
28   double d = 2000;
29   double *dptr = &d;
30   long double ld = 4000;
31   long double *ldptr = & ld;
32   struct printf_info info;
33 
34   memset (&info, 0, sizeof (info));
35   info.spec = L'f';
36 
37   /* Print a value with double type.  */
38   printf_size (stdout, &info, (void *) &dptr);
39 
40   /* Printf a value with long double type.  */
41   info.is_long_double = 1;
42   printf_size (stdout, &info, (void *) &ldptr);
43 
44   /* Setting both 'is_long_double' and 'is_binary128' to one is out of
45      the scope of this test, because such configuration is only valid
46      when _Float128 and long double are ABI-distinct (which is not
47      always true in this arch-independent test).  */
48   return 0;
49 }
50 
51 #include <support/test-driver.c>
52