From 5d1181fb3fe6b0ce51595dcde686ebb43ccb9824 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 4 Sep 2024 14:23:29 +0200 Subject: [PATCH] Fix GH-15742: php_hash_sha.h incompatible with C++ Not only MSVC doesn't support this construct, but apparently it is generally not supported by C++ compilers. Closes GH-15745. --- NEWS | 3 +++ ext/hash/php_hash_sha.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b3db10da6c7..43fba066e9d 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,9 @@ PHP NEWS - GD: . Added gdImageClone to bundled libgd. (David Carlier) +- Hash: + . Fixed bug GH-15742 (php_hash_sha.h incompatible with C++). (cmb) + - OpenSSL: . Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2. (Remi) diff --git a/ext/hash/php_hash_sha.h b/ext/hash/php_hash_sha.h index d5b04ddd2f4..748a2b2d63e 100644 --- a/ext/hash/php_hash_sha.h +++ b/ext/hash/php_hash_sha.h @@ -45,7 +45,7 @@ typedef struct { PHP_HASH_API void PHP_SHA256InitArgs(PHP_SHA256_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *, const unsigned char *, size_t); -#ifdef _MSC_VER +#if defined(__cplusplus) || defined(_MSC_VER) # define PHP_STATIC_RESTRICT #else # define PHP_STATIC_RESTRICT static restrict