]> granicus.if.org Git - php/commitdiff
Enable definitions of stdint.h limits/constants used by Zend/zend_long.h
authorSara Golemon <pollita@php.net>
Thu, 20 Aug 2015 18:09:43 +0000 (11:09 -0700)
committerSara Golemon <sgolemon@fb.com>
Thu, 20 Aug 2015 18:34:44 +0000 (11:34 -0700)
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).

main/php_stdint.h

index d04b67e17581b0ea2c484689ddcbbb66f0e00848..29a81f20bcb495887d1b62201be560a205b6d1a3 100644 (file)
 
 #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