Skip to content

Commit 29a8981

Browse files
committed
Enable definitions of stdint.h limits/constants used by Zend/zend_long.h
Define __STDC_LIMITS_MACROS and __STDC_CONSTANT_MACROS prior to including stdint.h for the first time so that it defines the INT64_MAX / INT64_C / etc... macros we use elsewhere when building for C++ (C already gets these).
1 parent 7ad1703 commit 29a8981

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

main/php_stdint.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@
4242

4343
#include "php_config.h"
4444

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+
4560
#if HAVE_SYS_TYPES_H
4661
# include <sys/types.h>
4762
#endif

0 commit comments

Comments
 (0)