Skip to content

Commit ddedad2

Browse files
committed
Suppress duplicated-branches compiler warning in SPL
1 parent 756bef6 commit ddedad2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ext/spl/spl_directory.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, size_
202202

203203
static inline int spl_filesystem_object_get_file_name(spl_filesystem_object *intern) /* {{{ */
204204
{
205+
/* On UNIX based systems '/' is identical to DEFAULT_SLASH */
206+
#pragma GCC diagnostic push
207+
#pragma GCC diagnostic ignored "-Wduplicated-branches"
205208
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
209+
#pragma GCC diagnostic pop
206210

207211
switch (intern->type) {
208212
case SPL_FS_INFO:
@@ -1481,7 +1485,11 @@ PHP_METHOD(RecursiveDirectoryIterator, getChildren)
14811485
zval zpath, zflags;
14821486
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
14831487
spl_filesystem_object *subdir;
1488+
/* On UNIX based systems '/' is identical to DEFAULT_SLASH */
1489+
#pragma GCC diagnostic push
1490+
#pragma GCC diagnostic ignored "-Wduplicated-branches"
14841491
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
1492+
#pragma GCC diagnostic pop
14851493

14861494
if (zend_parse_parameters_none() == FAILURE) {
14871495
RETURN_THROWS();
@@ -1532,7 +1540,11 @@ PHP_METHOD(RecursiveDirectoryIterator, getSubPath)
15321540
PHP_METHOD(RecursiveDirectoryIterator, getSubPathname)
15331541
{
15341542
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
1543+
/* On UNIX based systems '/' is identical to DEFAULT_SLASH */
1544+
#pragma GCC diagnostic push
1545+
#pragma GCC diagnostic ignored "-Wduplicated-branches"
15351546
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
1547+
#pragma GCC diagnostic pop
15361548

15371549
if (zend_parse_parameters_none() == FAILURE) {
15381550
RETURN_THROWS();

0 commit comments

Comments
 (0)