Backport fix for GH-17687

Introducing a new attribute macro in lower branches is an ABI break and
not allowed. However, we still need to fix the warnings such that
-Werror builds don't break. So we copy the macro from the master branch
to the C files in the appropriate places.
This commit is contained in:
Niels Dossche 2025-05-27 20:40:35 +02:00
parent b39e17b06c
commit fab0a6d75c
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
5 changed files with 28 additions and 4 deletions

View file

@ -1,6 +1,6 @@
/* This is a generated file, do not modify */
/* Usage: php create_data_file.php /path/to/magic.mgc > data_file.c */
const unsigned char php_magic_database[7955032] = {
const unsigned char php_magic_database[7955032] ZEND_NONSTRING = {
0x1C, 0x04, 0x1E, 0xF1, 0x12, 0x00, 0x00, 0x00, 0xD2, 0x3B, 0x00, 0x00, 0xD2, 0x16, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View file

@ -185,6 +185,12 @@ private struct {
{ NULL, 0, NULL }
};
#if __has_attribute(nonstring)
# define ZEND_NONSTRING __attribute__((nonstring))
#else
# define ZEND_NONSTRING
#endif
#include "../data_file.c"
#ifdef COMPILE_ONLY

View file

@ -24,8 +24,14 @@
#include "php_pdo.h"
#include "php_pdo_driver.h"
#if __has_attribute(nonstring)
# define ZEND_NONSTRING __attribute__((nonstring))
#else
# define ZEND_NONSTRING
#endif
struct pdo_sqlstate_info {
const char state[5];
const char state[5] ZEND_NONSTRING;
const char *desc;
};

View file

@ -317,8 +317,14 @@ static const char sha256_rounds_prefix[] = "rounds=";
/* Maximum number of rounds. */
#define ROUNDS_MAX 999999999
#if __has_attribute(nonstring)
# define ZEND_NONSTRING __attribute__((nonstring))
#else
# define ZEND_NONSTRING
#endif
/* Table with characters for base64 transformation. */
static const char b64t[64] =
static const char b64t[64] ZEND_NONSTRING =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen)

View file

@ -350,8 +350,14 @@ static const char sha512_rounds_prefix[] = "rounds=";
/* Maximum number of rounds. */
#define ROUNDS_MAX 999999999
#if __has_attribute(nonstring)
# define ZEND_NONSTRING __attribute__((nonstring))
#else
# define ZEND_NONSTRING
#endif
/* Table with characters for base64 transformation. */
static const char b64t[64] =
static const char b64t[64] ZEND_NONSTRING =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";