1 /* Utilities for MPFR developers, not exported. 2 3 Copyright 1999-2023 Free Software Foundation, Inc. 4 Contributed by the AriC and Caramba 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 https://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 #ifndef __MPFR_CVERS_H__ 24 #define __MPFR_CVERS_H__ 25 26 /* Macros to detect STDC, ICC, GCC, and GLIBC versions */ 27 #if defined(__STDC_VERSION__) 28 # define __MPFR_STDC(version) (__STDC_VERSION__ >= (version)) 29 #else 30 # define __MPFR_STDC(version) 0 31 #endif 32 33 #if defined(_WIN32) 34 /* Under MS Windows (e.g. with VS2008 or VS2010), Intel's compiler doesn't 35 support/enable extensions like the ones seen under GNU/Linux. 36 https://sympa.inria.fr/sympa/arc/mpfr/2011-02/msg00032.html */ 37 # define __MPFR_ICC(a,b,c) 0 38 #elif defined(__ICC) 39 # define __MPFR_ICC(a,b,c) (__ICC >= (a)*100+(b)*10+(c)) 40 #elif defined(__INTEL_COMPILER) 41 # define __MPFR_ICC(a,b,c) (__INTEL_COMPILER >= (a)*100+(b)*10+(c)) 42 #else 43 # define __MPFR_ICC(a,b,c) 0 44 #endif 45 46 #define __MPFR_MAJMIN(a,i) (((a) << 8) | (i)) 47 48 /* Instead of __MPFR_MAJMIN below, we could use code like 49 (__MAJ__ + (__MIN__ >= (i)) > (a)) 50 as in the patch at 51 https://sympa.inria.fr/sympa/arc/mpfr/2022-12/msg00007.html 52 */ 53 54 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && ! __MPFR_ICC(0,0,0) 55 # define __MPFR_GNUC(a,i) \ 56 (__MPFR_MAJMIN(__GNUC__,__GNUC_MINOR__) >= __MPFR_MAJMIN(a,i)) 57 #else 58 # define __MPFR_GNUC(a,i) 0 59 #endif 60 61 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__) 62 # define __MPFR_GLIBC(a,i) \ 63 (__MPFR_MAJMIN(__GLIBC__,__GLIBC_MINOR__) >= __MPFR_MAJMIN(a,i)) 64 #else 65 # define __MPFR_GLIBC(a,i) 0 66 #endif 67 68 #endif 69