1 /* Test file for multiple mpfr.h inclusion and intmax_t related functions 2 3 Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc. 4 Contributed by the AriC and Caramel projects, INRIA. 5 6 This file is part of the GNU MPFR Library. 7 8 The GNU MPFR Library is free software; you can redistribute it and/or modify 9 it under the terms of the GNU Lesser General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or (at your 11 option) any later version. 12 13 The GNU MPFR Library is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16 License for more details. 17 18 You should have received a copy of the GNU Lesser General Public License 19 along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see 20 http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 21 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ 22 23 #if HAVE_STDINT_H 24 25 #if _MPFR_EXP_FORMAT == 4 26 /* If mpfr_exp_t is defined as intmax_t, intmax_t must be defined before 27 the inclusion of mpfr.h (this test doesn't use mpfr-impl.h). */ 28 # include <stdint.h> 29 #endif 30 31 /* Assume that this is in fact a header inclusion for some library 32 that uses MPFR, i.e. this inclusion is hidden in another one. 33 MPFR currently (rev 6704) fails to handle this case. */ 34 #include <mpfr.h> 35 36 #include <stdint.h> 37 38 #define MPFR_USE_INTMAX_T 39 #include <mpfr.h> 40 41 int 42 main (void) 43 { 44 mpfr_t x; 45 intmax_t j; 46 47 mpfr_init_set_ui (x, 1, MPFR_RNDN); 48 j = mpfr_get_uj (x, MPFR_RNDN); 49 mpfr_clear (x); 50 return j == 1 ? 0 : 1; 51 } 52 53 #else /* HAVE_STDINT_H */ 54 55 /* The test is disabled. */ 56 57 int 58 main (void) 59 { 60 return 77; 61 } 62 63 #endif /* HAVE_STDINT_H */ 64