RE: [PHP-CVS] com php-src: Enable definitions of stdint.h limits/constants used by Zend/zend_long.h: main/php_stdint.h
| From: | Anatol Belski | Date: | Thu, 20 Aug 2015 20:44:48 +0000 |
| Subject: | RE: [PHP-CVS] com php-src: Enable definitions of stdint.h limits/constants used by Zend/zend_long.h: main/php_stdint.h | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-88707@lists.php.net to get a copy of this message | ||
Hi Sara,
> -----Original Message-----
> From: Sara Golemon [mailto:pollita@php.net]
> Sent: Thursday, August 20, 2015 8:35 PM
> To: php-cvs@lists.php.net
> Subject: [PHP-CVS] com php-src: Enable definitions of stdint.h limits/constants
> used by Zend/zend_long.h: main/php_stdint.h
>
> 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
>
Thanks for the push, I was too slow in response. What I would suggest yet is to extend this onto the
Windows part as well and to #ifndef the actual defines just for the case some code already had it
defined.
Regards
Anatol