ICU-9141 add U_GCC_MAJOR_MINOR macro

X-SVN-Rev: 32252
This commit is contained in:
Markus Scherer 2012-08-27 23:15:08 +00:00
parent 6d5c99bb7e
commit 944ff6eeaf
4 changed files with 24 additions and 8 deletions

View File

@ -180,7 +180,7 @@ typedef size_t uintptr_t;
*/
#ifdef U_HAVE_GCC_ATOMICS
/* Use the predefined value. */
#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 404)
#elif U_GCC_MAJOR_MINOR >= 404
# define U_HAVE_GCC_ATOMICS 1
#else
# define U_HAVE_GCC_ATOMICS 0

View File

@ -336,6 +336,22 @@
/** @{ Compiler and environment features */
/*===========================================================================*/
/**
* \def U_GCC_MAJOR_MINOR
* Indicates whether the compiler is gcc (test for != 0),
* and if so, contains its major (times 100) and minor version numbers.
* If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.
*
* For example, for testing for whether we have gcc, and whether it's 4.6 or higher,
* use "#if U_GCC_MAJOR_MINOR >= 406".
* @internal
*/
#ifdef __GNUC__
# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)
#else
# define U_GCC_MAJOR_MINOR 0
#endif
/**
* \def U_IS_BIG_ENDIAN
* Determines the endianness of the platform.

View File

@ -89,7 +89,7 @@
* This is used for GCC specific attributes
* @internal
*/
#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
#if U_GCC_MAJOR_MINOR >= 302
# define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
/**
* \def U_ATTRIBUTE_DEPRECATED

View File

@ -1405,7 +1405,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *res, const decNumber
/* fastpath in decLnOp. The final division is done to the requested */
/* precision. */
/* ------------------------------------------------------------------ */
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
@ -1544,7 +1544,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber
#endif
return res;
} /* decNumberLog10 */
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
#pragma GCC diagnostic pop
#endif
@ -2820,7 +2820,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberShift(decNumber *res, const decNumber
/* result setexp(approx, e div 2) % fix exponent */
/* end sqrt */
/* ------------------------------------------------------------------ */
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
@ -3153,7 +3153,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
#endif
return res;
} /* decNumberSquareRoot */
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
#pragma GCC diagnostic pop
#endif
@ -5617,7 +5617,7 @@ static const uShort LNnn[90]={9016, 8652, 8316, 8008, 7724, 7456, 7208,
/* 5. The static buffers are larger than might be expected to allow */
/* for calls from decNumberPower. */
/* ------------------------------------------------------------------ */
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
@ -5842,7 +5842,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
/* [status is handled by caller] */
return res;
} /* decLnOp */
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406
#pragma GCC diagnostic pop
#endif