|
19 | 19 | #ifndef PHP_STDINT_H
|
20 | 20 | #define PHP_STDINT_H
|
21 | 21 |
|
| 22 | +/* C99 requires these for C++ to get the definitions |
| 23 | + * of INT64_MAX and other macros used by Zend/zend_long.h |
| 24 | + * C11 drops this requirement, so these effectively |
| 25 | + * just backport that piece of behavior. |
| 26 | + * |
| 27 | + * These defines are placed here instead of |
| 28 | + * with the include below, because sys/types |
| 29 | + * and inttypes may include stdint themselves. |
| 30 | + * And these definitions MUST come first. |
| 31 | + */ |
| 32 | +#ifdef __cplusplus |
| 33 | +# ifndef __STDC_LIMIT_MACROS |
| 34 | +# define __STDC_LIMIT_MACROS |
| 35 | +# endif |
| 36 | +# ifndef __STDC_CONSTANT_MACROS |
| 37 | +# define __STDC_CONSTANT_MACROS |
| 38 | +# endif |
| 39 | +#endif |
| 40 | + |
22 | 41 | #if defined(_MSC_VER)
|
23 | 42 | /* Make sure the regular stdint.h wasn't included already and prevent it to be
|
24 | 43 | included afterwards. Though if some other library needs some stuff from
|
|
42 | 61 |
|
43 | 62 | #include "php_config.h"
|
44 | 63 |
|
45 |
| -#if HAVE_STDINT_H && defined(__cplusplus) |
46 |
| - /* C99 requires these for C++ to get the definitions |
47 |
| - * of INT64_MAX and other macros used by Zend/zend_long.h |
48 |
| - * C11 drops this requirement, so these effectively |
49 |
| - * just backport that piece of behavior. |
50 |
| - * |
51 |
| - * These defines are placed here instead of |
52 |
| - * with the include below, because sys/types |
53 |
| - * and inttypes may include stdint themselves. |
54 |
| - * And these definitions MUST come first. |
55 |
| - */ |
56 |
| -# define __STDC_LIMIT_MACROS |
57 |
| -# define __STDC_CONSTANT_MACROS |
58 |
| -#endif |
59 |
| - |
60 | 64 | #if HAVE_SYS_TYPES_H
|
61 | 65 | # include <sys/types.h>
|
62 | 66 | #endif
|
|
0 commit comments