José Fonseca | 70fe7c6 | 2013-03-12 11:17:49 +0000 | [diff] [blame^] | 1 | /************************************************************************** |
| 2 | * |
| 3 | * Copyright 2007-2013 VMware, Inc. |
| 4 | * All Rights Reserved. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the |
| 8 | * "Software"), to deal in the Software without restriction, including |
| 9 | * without limitation the rights to use, copy, modify, merge, publish, |
| 10 | * distribute, sub license, and/or sell copies of the Software, and to |
| 11 | * permit persons to whom the Software is furnished to do so, subject to |
| 12 | * the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice (including the |
| 15 | * next paragraph) shall be included in all copies or substantial portions |
| 16 | * of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR |
| 22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 25 | * |
| 26 | **************************************************************************/ |
| 27 | |
| 28 | #ifndef _C99_COMPAT_H_ |
| 29 | #define _C99_COMPAT_H_ |
| 30 | |
| 31 | |
| 32 | /* |
| 33 | * C99 inline keyword |
| 34 | */ |
| 35 | #ifndef inline |
| 36 | # ifdef __cplusplus |
| 37 | /* C++ supports inline keyword */ |
| 38 | # elif defined(__GNUC__) |
| 39 | # define inline __inline__ |
| 40 | # elif defined(_MSC_VER) |
| 41 | # define inline __inline |
| 42 | # elif defined(__ICL) |
| 43 | # define inline __inline |
| 44 | # elif defined(__INTEL_COMPILER) |
| 45 | /* Intel compiler supports inline keyword */ |
| 46 | # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) |
| 47 | # define inline __inline |
| 48 | # elif defined(__SUNPRO_C) && defined(__C99FEATURES__) |
| 49 | /* C99 supports inline keyword */ |
| 50 | # elif (__STDC_VERSION__ >= 199901L) |
| 51 | /* C99 supports inline keyword */ |
| 52 | # else |
| 53 | # define inline |
| 54 | # endif |
| 55 | #endif |
| 56 | |
| 57 | |
| 58 | /* |
| 59 | * C99 restrict keyword |
| 60 | * |
| 61 | * See also: |
| 62 | * - http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html |
| 63 | */ |
| 64 | #ifndef restrict |
| 65 | # if (__STDC_VERSION__ >= 199901L) |
| 66 | /* C99 */ |
| 67 | # elif defined(__SUNPRO_C) && defined(__C99FEATURES__) |
| 68 | /* C99 */ |
| 69 | # elif defined(__GNUC__) |
| 70 | # define restrict __restrict__ |
| 71 | # elif defined(_MSC_VER) |
| 72 | # define restrict __restrict |
| 73 | # else |
| 74 | # define restrict /* */ |
| 75 | # endif |
| 76 | #endif |
| 77 | |
| 78 | |
| 79 | /* |
| 80 | * C99 __func__ macro |
| 81 | */ |
| 82 | #ifndef __func__ |
| 83 | # if (__STDC_VERSION__ >= 199901L) |
| 84 | /* C99 */ |
| 85 | # elif defined(__SUNPRO_C) && defined(__C99FEATURES__) |
| 86 | /* C99 */ |
| 87 | # elif defined(__GNUC__) |
| 88 | # if __GNUC__ >= 2 |
| 89 | # define __func__ __FUNCTION__ |
| 90 | # else |
| 91 | # define __func__ "<unknown>" |
| 92 | # endif |
| 93 | # elif defined(_MSC_VER) |
| 94 | # if _MSC_VER >= 1300 |
| 95 | # define __func__ __FUNCTION__ |
| 96 | # else |
| 97 | # define __func__ "<unknown>" |
| 98 | # endif |
| 99 | # else |
| 100 | # define __func__ "<unknown>" |
| 101 | # endif |
| 102 | #endif |
| 103 | |
| 104 | |
| 105 | #endif /* _C99_COMPAT_H_ */ |