OLD | NEW |
1 /* | 1 /* |
2 ****************************************************************************** | 2 ****************************************************************************** |
3 * | 3 * |
4 * Copyright (C) 1997-2015, International Business Machines | 4 * Copyright (C) 1997-2015, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ****************************************************************************** | 7 ****************************************************************************** |
8 * | 8 * |
9 * FILE NAME : putilimp.h | 9 * FILE NAME : putilimp.h |
10 * | 10 * |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 /** | 206 /** |
207 * \def U_HAVE_STD_ATOMICS | 207 * \def U_HAVE_STD_ATOMICS |
208 * Defines whether the standard C++11 <atomic> is available. | 208 * Defines whether the standard C++11 <atomic> is available. |
209 * ICU will use this when avialable, | 209 * ICU will use this when avialable, |
210 * otherwise will fall back to compiler or platform specific alternatives. | 210 * otherwise will fall back to compiler or platform specific alternatives. |
211 * @internal | 211 * @internal |
212 */ | 212 */ |
213 #ifdef U_HAVE_STD_ATOMICS | 213 #ifdef U_HAVE_STD_ATOMICS |
214 /* Use the predefined value. */ | 214 /* Use the predefined value. */ |
215 #elif !defined(__cplusplus) || __cplusplus<201103L | 215 #elif U_CPLUSPLUS_VERSION < 11 |
216 /* Not C++11, disable use of atomics */ | 216 /* Not C++11, disable use of atomics */ |
217 # define U_HAVE_STD_ATOMICS 0 | 217 # define U_HAVE_STD_ATOMICS 0 |
218 #elif __clang__ && __clang_major__==3 && __clang_minor__<=1 | 218 #elif __clang__ && __clang_major__==3 && __clang_minor__<=1 |
219 /* Clang 3.1, has atomic variable initializer bug. */ | 219 /* Clang 3.1, has atomic variable initializer bug. */ |
220 # define U_HAVE_STD_ATOMICS 0 | 220 # define U_HAVE_STD_ATOMICS 0 |
221 #else | 221 #else |
222 /* U_HAVE_ATOMIC is typically set by an autoconf test of #include <atomic>
*/ | 222 /* U_HAVE_ATOMIC is typically set by an autoconf test of #include <atomic>
*/ |
223 /* Can be set manually, or left undefined, on platforms without autoconf.
*/ | 223 /* Can be set manually, or left undefined, on platforms without autoconf.
*/ |
224 # if defined(U_HAVE_ATOMIC) && U_HAVE_ATOMIC | 224 # if defined(U_HAVE_ATOMIC) && U_HAVE_ATOMIC |
225 # define U_HAVE_STD_ATOMICS 1 | 225 # define U_HAVE_STD_ATOMICS 1 |
226 # else | 226 # else |
227 # define U_HAVE_STD_ATOMICS 0 | 227 # define U_HAVE_STD_ATOMICS 0 |
228 # endif | 228 # endif |
229 #endif | 229 #endif |
230 | 230 |
231 | 231 |
232 /** | 232 /** |
233 * \def U_HAVE_CLANG_ATOMICS | 233 * \def U_HAVE_CLANG_ATOMICS |
234 * Defines whether Clang c11 style built-in atomics are avaialable. | 234 * Defines whether Clang c11 style built-in atomics are avaialable. |
235 * These are used in preference to gcc atomics when both are available. | 235 * These are used in preference to gcc atomics when both are available. |
236 */ | 236 */ |
237 #ifdef U_HAVE_CLANG_ATOMICS | 237 #ifdef U_HAVE_CLANG_ATOMICS |
238 /* Use the predefined value. */ | 238 /* Use the predefined value. */ |
239 #elif !defined(__clang__) | 239 #elif __has_builtin(__c11_atomic_load) && \ |
240 # define U_HAVE_CLANG_ATOMICS 0 | |
241 #else | |
242 #if __has_builtin(__c11_atomic_load) && \ | |
243 __has_builtin(__c11_atomic_store) && \ | 240 __has_builtin(__c11_atomic_store) && \ |
244 __has_builtin(__c11_atomic_fetch_add) && \ | 241 __has_builtin(__c11_atomic_fetch_add) && \ |
245 __has_builtin(__c11_atomic_fetch_sub) | 242 __has_builtin(__c11_atomic_fetch_sub) |
246 # define U_HAVE_CLANG_ATOMICS 1 | 243 # define U_HAVE_CLANG_ATOMICS 1 |
247 #else | 244 #else |
248 # define U_HAVE_CLANG_ATOMICS 0 | 245 # define U_HAVE_CLANG_ATOMICS 0 |
249 #endif | 246 #endif |
250 #endif | |
251 | |
252 /*===========================================================================*/ | |
253 /** @{ Code alignment */ | |
254 /*===========================================================================*/ | |
255 | |
256 /** | |
257 * \def U_ALIGN_CODE | |
258 * This is used to align code fragments to a specific byte boundary. | |
259 * This is useful for getting consistent performance test results. | |
260 * @internal | |
261 */ | |
262 #ifdef U_ALIGN_CODE | |
263 /* Use the predefined value. */ | |
264 #elif defined(_MSC_VER) && defined(_M_IX86) && !defined(_MANAGED) | |
265 # define U_ALIGN_CODE(boundarySize) __asm align boundarySize | |
266 #else | |
267 # define U_ALIGN_CODE(boundarySize) | |
268 #endif | |
269 | |
270 /** @} */ | |
271 | 247 |
272 /*===========================================================================*/ | 248 /*===========================================================================*/ |
273 /** @{ Programs used by ICU code */ | 249 /** @{ Programs used by ICU code */ |
274 /*===========================================================================*/ | 250 /*===========================================================================*/ |
275 | 251 |
276 /** | 252 /** |
277 * \def U_MAKE_IS_NMAKE | 253 * \def U_MAKE_IS_NMAKE |
278 * Defines whether the "make" program is Windows nmake. | 254 * Defines whether the "make" program is Windows nmake. |
279 */ | 255 */ |
280 #ifdef U_MAKE_IS_NMAKE | 256 #ifdef U_MAKE_IS_NMAKE |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 * tzname(0) Three-letter time-zone name derived from TZ environment | 472 * tzname(0) Three-letter time-zone name derived from TZ environment |
497 * variable. E.g., "PST". | 473 * variable. E.g., "PST". |
498 * tzname(1) Three-letter DST zone name derived from TZ environment | 474 * tzname(1) Three-letter DST zone name derived from TZ environment |
499 * variable. E.g., "PDT". If DST zone is omitted from TZ, | 475 * variable. E.g., "PDT". If DST zone is omitted from TZ, |
500 * tzname(1) is an empty string. | 476 * tzname(1) is an empty string. |
501 * @internal | 477 * @internal |
502 */ | 478 */ |
503 U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n); | 479 U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n); |
504 | 480 |
505 /** | 481 /** |
506 * Reset the global tzname cache. | |
507 * @internal | |
508 */ | |
509 U_INTERNAL void uprv_tzname_clear_cache(); | |
510 | |
511 /** | |
512 * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. | 482 * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. |
513 * This function is affected by 'faketime' and should be the bottleneck for all
user-visible ICU time functions. | 483 * This function is affected by 'faketime' and should be the bottleneck for all
user-visible ICU time functions. |
514 * @return the UTC time measured in milliseconds | 484 * @return the UTC time measured in milliseconds |
515 * @internal | 485 * @internal |
516 */ | 486 */ |
517 U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void); | 487 U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void); |
518 | 488 |
519 /** | 489 /** |
520 * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. | 490 * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. |
521 * This function is not affected by 'faketime', so it should only be used by low
level test functions- not by anything that | 491 * This function is not affected by 'faketime', so it should only be used by low
level test functions- not by anything that |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 /* also _C_TS_calloc(x) */ | 598 /* also _C_TS_calloc(x) */ |
629 #else | 599 #else |
630 /* C defaults */ | 600 /* C defaults */ |
631 # define uprv_default_malloc(x) malloc(x) | 601 # define uprv_default_malloc(x) malloc(x) |
632 # define uprv_default_realloc(x,y) realloc(x,y) | 602 # define uprv_default_realloc(x,y) realloc(x,y) |
633 # define uprv_default_free(x) free(x) | 603 # define uprv_default_free(x) free(x) |
634 #endif | 604 #endif |
635 | 605 |
636 | 606 |
637 #endif | 607 #endif |
OLD | NEW |