summaryrefslogtreecommitdiff
path: root/main/php_stdint.h
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2015-08-20 11:09:43 -0700
committerSara Golemon <sgolemon@fb.com>2015-08-20 11:34:44 -0700
commit29a8981c81a7403070305ab4631c2fa9e858a082 (patch)
treeed9ecf06cc18a8312e7d9692cf64a05bc43c4b0b /main/php_stdint.h
parent7ad170341303933eae4e9d30e5048cb462f0817d (diff)
downloadphp-git-29a8981c81a7403070305ab4631c2fa9e858a082.tar.gz
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).
Diffstat (limited to 'main/php_stdint.h')
-rw-r--r--main/php_stdint.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/php_stdint.h b/main/php_stdint.h
index d04b67e175..29a81f20bc 100644
--- a/main/php_stdint.h
+++ b/main/php_stdint.h
@@ -42,6 +42,21 @@
#include "php_config.h"
+#if HAVE_STDINT_H && defined(__cplusplus)
+ /* C99 requires these for C++ to get the definitions
+ * of INT64_MAX and other macros used by Zend/zend_long.h
+ * C11 drops this requirement, so these effectively
+ * just backport that piece of behavior.
+ *
+ * These defines are placed here instead of
+ * with the include below, because sys/types
+ * and inttypes may include stdint themselves.
+ * And these definitions MUST come first.
+ */
+# define __STDC_LIMIT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
+
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif