com php-src: Enable definitions of stdint.h limits/constants used by Zend/zend_long.h: main/php_stdint.h
| From: | Sara Golemon | Date: | Thu, 20 Aug 2015 18:34:44 +0000 |
| Subject: | com php-src: Enable definitions of stdint.h limits/constants used by Zend/zend_long.h: main/php_stdint.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88706@lists.php.net to get a copy of this message | ||
Commit: 29a8981c81a7403070305ab4631c2fa9e858a082
Author: Sara Golemon <pollita@php.net> Thu, 20 Aug 2015 11:09:43 -0700
Committer: Sara Golemon <sgolemon@fb.com> Thu, 20 Aug 2015 11:34:44 -0700
Parents: 7ad170341303933eae4e9d30e5048cb462f0817d
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=29a8981c81a7403070305ab4631c2fa9e858a082
Log:
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).
Changed paths:
M main/php_stdint.h
Diff:
diff --git a/main/php_stdint.h b/main/php_stdint.h
index d04b67e..29a81f2 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