Skip to content

Commit 9956f8a

Browse files
committed
Add pragmas
1 parent b80d508 commit 9956f8a

File tree

5 files changed

+129
-27
lines changed

5 files changed

+129
-27
lines changed

Zend/zend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ typedef size_t (*zend_write_func_t)(const char *str, size_t str_length);
269269

270270
#define zend_try \
271271
{ \
272+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
272273
JMP_BUF *__orig_bailout = EG(bailout); \
273274
JMP_BUF __bailout; \
275+
ZEND_DIAGNOSTIC_IGNORED_END \
274276
\
275277
EG(bailout) = &__bailout; \
276278
if (SETJMP(__bailout)==0) {

Zend/zend_hash.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,38 +1000,48 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
10001000
((zval*)(((char*)(_el)) - (_size)))
10011001

10021002
#define _ZEND_HASH_FOREACH_VAL(_ht) do { \
1003+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
10031004
const HashTable *__ht = (_ht); \
10041005
uint32_t _count = __ht->nNumUsed; \
10051006
size_t _size = ZEND_HASH_ELEMENT_SIZE(__ht); \
10061007
zval *_z = __ht->arPacked; \
1008+
ZEND_DIAGNOSTIC_IGNORED_END \
10071009
for (; _count > 0; _z = ZEND_HASH_NEXT_ELEMENT(_z, _size), _count--) { \
10081010
if (UNEXPECTED(Z_TYPE_P(_z) == IS_UNDEF)) continue;
10091011

10101012
#define _ZEND_HASH_REVERSE_FOREACH_VAL(_ht) do { \
1013+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
10111014
const HashTable *__ht = (_ht); \
10121015
uint32_t _idx = __ht->nNumUsed; \
10131016
size_t _size = ZEND_HASH_ELEMENT_SIZE(__ht); \
10141017
zval *_z = ZEND_HASH_ELEMENT_EX(__ht, _idx, _size); \
1018+
ZEND_DIAGNOSTIC_IGNORED_END \
10151019
for (;_idx > 0; _idx--) { \
10161020
_z = ZEND_HASH_PREV_ELEMENT(_z, _size); \
10171021
if (UNEXPECTED(Z_TYPE_P(_z) == IS_UNDEF)) continue;
10181022

10191023
#define ZEND_HASH_FOREACH_FROM(_ht, indirect, _from) do { \
1024+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
10201025
const HashTable *__ht = (_ht); \
10211026
zend_ulong __h; \
10221027
zend_string *__key = NULL; \
10231028
uint32_t _idx = (_from); \
10241029
size_t _size = ZEND_HASH_ELEMENT_SIZE(__ht); \
10251030
zval *__z = ZEND_HASH_ELEMENT_EX(__ht, _idx, _size); \
10261031
uint32_t _count = __ht->nNumUsed - _idx; \
1032+
ZEND_DIAGNOSTIC_IGNORED_END \
10271033
for (;_count > 0; _count--) { \
1034+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
10281035
zval *_z = __z; \
1036+
ZEND_DIAGNOSTIC_IGNORED_END \
10291037
if (HT_IS_PACKED(__ht)) { \
10301038
__z++; \
10311039
__h = _idx; \
10321040
_idx++; \
10331041
} else { \
1042+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
10341043
Bucket *_p = (Bucket*)__z; \
1044+
ZEND_DIAGNOSTIC_IGNORED_END \
10351045
__z = &(_p + 1)->val; \
10361046
__h = _p->h; \
10371047
__key = _p->key; \
@@ -1045,20 +1055,24 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
10451055
#define ZEND_HASH_FOREACH(_ht, indirect) ZEND_HASH_FOREACH_FROM(_ht, indirect, 0)
10461056

10471057
#define ZEND_HASH_REVERSE_FOREACH(_ht, indirect) do { \
1058+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
10481059
const HashTable *__ht = (_ht); \
10491060
uint32_t _idx = __ht->nNumUsed; \
10501061
zval *_z; \
10511062
zend_ulong __h; \
10521063
zend_string *__key = NULL; \
10531064
size_t _size = ZEND_HASH_ELEMENT_SIZE(__ht); \
10541065
zval *__z = ZEND_HASH_ELEMENT_EX(__ht, _idx, _size); \
1066+
ZEND_DIAGNOSTIC_IGNORED_END \
10551067
for (;_idx > 0; _idx--) { \
10561068
if (HT_IS_PACKED(__ht)) { \
10571069
__z--; \
10581070
_z = __z; \
10591071
__h = _idx - 1; \
10601072
} else { \
1073+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
10611074
Bucket *_p = (Bucket*)__z; \
1075+
ZEND_DIAGNOSTIC_IGNORED_END \
10621076
_p--; \
10631077
__z = &_p->val; \
10641078
_z = __z; \
@@ -1234,12 +1248,16 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
12341248

12351249
/* Hash array iterators */
12361250
#define ZEND_HASH_MAP_FOREACH_FROM(_ht, indirect, _from) do { \
1251+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
12371252
const HashTable *__ht = (_ht); \
12381253
Bucket *_p = __ht->arData + (_from); \
12391254
const Bucket *_end = __ht->arData + __ht->nNumUsed; \
1255+
ZEND_DIAGNOSTIC_IGNORED_END \
12401256
ZEND_ASSERT(!HT_IS_PACKED(__ht)); \
12411257
for (; _p != _end; _p++) { \
1258+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
12421259
zval *_z = &_p->val; \
1260+
ZEND_DIAGNOSTIC_IGNORED_END \
12431261
if (indirect && Z_TYPE_P(_z) == IS_INDIRECT) { \
12441262
_z = Z_INDIRECT_P(_z); \
12451263
} \
@@ -1248,10 +1266,12 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
12481266
#define ZEND_HASH_MAP_FOREACH(_ht, indirect) ZEND_HASH_MAP_FOREACH_FROM(_ht, indirect, 0)
12491267

12501268
#define ZEND_HASH_MAP_REVERSE_FOREACH(_ht, indirect) do { \
1269+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
12511270
/* const */ HashTable *__ht = (_ht); \
12521271
uint32_t _idx = __ht->nNumUsed; \
12531272
Bucket *_p = __ht->arData + _idx; \
12541273
zval *_z; \
1274+
ZEND_DIAGNOSTIC_IGNORED_END \
12551275
ZEND_ASSERT(!HT_IS_PACKED(__ht)); \
12561276
for (_idx = __ht->nNumUsed; _idx > 0; _idx--) { \
12571277
_p--; \
@@ -1265,11 +1285,15 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
12651285
ZEND_ASSERT(!HT_IS_PACKED(__ht)); \
12661286
__ht->nNumOfElements--; \
12671287
do { \
1288+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
12681289
uint32_t j = HT_IDX_TO_HASH(_idx - 1); \
12691290
uint32_t nIndex = _p->h | __ht->nTableMask; \
12701291
uint32_t i = HT_HASH(__ht, nIndex); \
1292+
ZEND_DIAGNOSTIC_IGNORED_END \
12711293
if (UNEXPECTED(j != i)) { \
1294+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
12721295
Bucket *prev = HT_HASH_TO_BUCKET(__ht, i); \
1296+
ZEND_DIAGNOSTIC_IGNORED_END \
12731297
while (Z_NEXT(prev->val) != j) { \
12741298
i = Z_NEXT(prev->val); \
12751299
prev = HT_HASH_TO_BUCKET(__ht, i); \
@@ -1442,10 +1466,12 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
14421466

14431467
/* Packed array iterators */
14441468
#define ZEND_HASH_PACKED_FOREACH_FROM(_ht, _from) do { \
1469+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
14451470
const HashTable *__ht = (_ht); \
14461471
zend_ulong _idx = (_from); \
14471472
zval *_z = __ht->arPacked + (_from); \
14481473
zval *_end = __ht->arPacked + __ht->nNumUsed; \
1474+
ZEND_DIAGNOSTIC_IGNORED_END \
14491475
ZEND_ASSERT(HT_IS_PACKED(__ht)); \
14501476
for (;_z != _end; _z++, _idx++) { \
14511477
(void) _idx; \
@@ -1454,9 +1480,11 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
14541480
#define ZEND_HASH_PACKED_FOREACH(_ht) ZEND_HASH_PACKED_FOREACH_FROM(_ht, 0)
14551481

14561482
#define ZEND_HASH_PACKED_REVERSE_FOREACH(_ht) do { \
1483+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
14571484
const HashTable *__ht = (_ht); \
14581485
zend_ulong _idx = __ht->nNumUsed; \
14591486
zval *_z = __ht->arPacked + _idx; \
1487+
ZEND_DIAGNOSTIC_IGNORED_END \
14601488
ZEND_ASSERT(HT_IS_PACKED(__ht)); \
14611489
while (_idx > 0) { \
14621490
_z--; \
@@ -1514,9 +1542,11 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
15141542
* (HashTable must have enough free buckets).
15151543
*/
15161544
#define ZEND_HASH_FILL_PACKED(ht) do { \
1545+
ZEND_DIAGNOSTIC_IGNORED_START("-Wshadow") \
15171546
HashTable *__fill_ht = (ht); \
15181547
zval *__fill_val = __fill_ht->arPacked + __fill_ht->nNumUsed; \
15191548
uint32_t __fill_idx = __fill_ht->nNumUsed; \
1549+
ZEND_DIAGNOSTIC_IGNORED_END \
15201550
ZEND_ASSERT(HT_IS_PACKED(__fill_ht));
15211551

15221552
#define ZEND_HASH_FILL_GROW() do { \

0 commit comments

Comments
 (0)