Skip to content

php_hash_sha.h incompatible with C++ #15742

Closed
@matyhtf

Description

@matyhtf

Description

Error:

 g++ -I. -I/home/htf/workspace/swoole -I/opt/php-8.4-zts/include/php -I/opt/php-8.4-zts/include/php/main -I/opt/php-8.4-zts/include/php/TSRM -I/opt/php-8.4-zts/include/php/Zend -I/opt/php-8.4-zts/include/php/ext -I/opt/php-8.4-zts/include/php/ext/date/lib -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/thirdparty -I/home/htf/workspace/swoole -I/home/htf/workspace/swoole/include -I/home/htf/workspace/swoole/ext-src -I/home/htf/workspace/swoole/thirdparty -I/home/htf/workspace/swoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O0 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -I/usr/include/postgresql -I/opt/php-8.4-zts/include/php/ext -I/usr/include -DPDO_ODBC_TYPE=\"unixODBC\" -DENABLE_PHP_SWOOLE -DZEND_COMPILE_DL_EXT=1 -c /home/htf/workspace/swoole/ext-src/swoole_mysql_coro.cc -MMD -MF ext-src/swoole_mysql_coro.dep -MT ext-src/swoole_mysql_coro.lo  -fPIC -DPIC -o ext-src/.libs/swoole_mysql_coro.o
In file included from /home/htf/workspace/swoole/ext-src/swoole_mysql_coro.cc:31:
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:51:30: error: expected primary-expression before ‘static’
   51 | # define PHP_STATIC_RESTRICT static restrict
      |                              ^~~~~~
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:55:43: note: in expansion of macro ‘PHP_STATIC_RESTRICT’
   55 | void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64], uint32_t W[PHP_STATIC_RESTRICT 64], uint32_t S[PHP_STATIC_RESTRICT 8]);
      |                                           ^~~~~~~~~~~~~~~~~~~
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:55:43: error: expected ‘]’ before ‘static’
   55 | void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64], uint32_t W[PHP_STATIC_RESTRICT 64], uint32_t S[PHP_STATIC_RESTRICT 8]);
      |                                           ^
      |                                           ]
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:55:43: error: expected ‘)’ before ‘static’
   55 | void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64], uint32_t W[PHP_STATIC_RESTRICT 64], uint32_t S[PHP_STATIC_RESTRICT 8]);
      |                           ~               ^
      |                                           )
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:51:30: error: expected initializer before ‘static’
   51 | # define PHP_STATIC_RESTRICT static restrict
      |                              ^~~~~~
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:55:43: note: in expansion of macro ‘PHP_STATIC_RESTRICT’
   55 | void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64], uint32_t W[PHP_STATIC_RESTRICT 64], uint32_t S[PHP_STATIC_RESTRICT 8]);
      |                                           ^~~~~~~~~~~~~~~~~~~
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:51:30: error: expected primary-expression before ‘static’
   51 | # define PHP_STATIC_RESTRICT static restrict
      |                              ^~~~~~
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:67:44: note: in expansion of macro ‘PHP_STATIC_RESTRICT’
   67 | void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]);
      |                                            ^~~~~~~~~~~~~~~~~~~
In file included from /home/htf/workspace/swoole/ext-src/swoole_mysql_coro.cc:31:
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:67:44: error: expected ‘]’ before ‘static’
   67 | void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]);
      |                                            ^
      |                                            ]
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:67:44: error: expected ‘)’ before ‘static’
   67 | void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]);
      |                            ~               ^
      |                                            )
In file included from /home/htf/workspace/swoole/ext-src/swoole_mysql_coro.cc:31:
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:51:30: error: expected initializer before ‘static’
   51 | # define PHP_STATIC_RESTRICT static restrict
      |                              ^~~~~~
/opt/php-8.4-zts/include/php/ext/hash/php_hash_sha.h:67:44: note: in expansion of macro ‘PHP_STATIC_RESTRICT’
   67 | void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]);
      |                                            ^~~~~~~~~~~~~~~~~~~
make: *** [Makefile:306:ext-src/swoole_mysql_coro.lo] Error 1

Code:

#include "php_swoole_cxx.h"
#include "php_swoole_mysql_proto.h"

#include "swoole_string.h"

// see mysqlnd 'L64' macro redefined
#undef L64

SW_EXTERN_C_BEGIN

#include "ext/hash/php_hash.h"
#include "ext/hash/php_hash_sha.h"
#include "ext/standard/php_math.h"
#ifdef SW_USE_MYSQLND
#include "ext/mysqlnd/mysqlnd.h"
#include "ext/mysqlnd/mysqlnd_charset.h"
#endif
SW_EXTERN_C_END

PHP Version

PHP 8.4

Operating System

Ubuntu 22.04.4 LTS

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions