Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code due to 'if 0' #1297

Closed
wants to merge 1 commit into from

Conversation

kaplanlior
Copy link
Contributor

No description provided.

@smalyshev
Copy link
Contributor

are you sure we need to be removing all of it? some may be useful...

@kaplanlior
Copy link
Contributor Author

If there's a specific code you want to keep, let me know. Otherwise most of the code it quite old (5-10 years).

Relatively new dead code were kept (e.g ext/gd/libgd/gd_crop.c due to rev a991360), same with dead code who seem useful for future reader (e.g. sapi/phpdbg/phpdbg_parser.c ).

@weltling
Copy link
Contributor

I would suggest to not to touch anything in the bundled libraries like libgd, libmagic, oniguruma, libmbfl and so on. Once they will need to be patched, upgraded, or etc. and that can bring some unnecessary conflicts.

Thanks.

@kaplanlior
Copy link
Contributor Author

Thanks @weltling, I removed libpcre & oniguruma changes (both got updated recently).

libgd as last updated in 2007 and libmbfl upstream is quite dead (last release 4 years ago). So I felt comfortable to touch that code.

@@ -4143,7 +4112,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER

static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
#if 0 || (IS_CONST != IS_UNUSED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generated code, it should not be changed (or only via zend_vm_def.h). Otherwise these 0 || will just reappear the next time someone regenerates the VM.

@nikic
Copy link
Member

nikic commented May 23, 2015

Some of these look like commented out debugging code - may it be valuable to retain it? Also seen some with a TODO in them. Those probably should stay.

@kaplanlior
Copy link
Contributor Author

Thanks @nikic , I've excluded Zend/zend_vm_execute.h from this PR. Any help with further editing zend_vm_def.h to remove these "if 0 ||" section would be welcomed.

Also, brought back one TODO section. Thanks for noticing.

@dstogov
Copy link
Member

dstogov commented May 27, 2015

Please keep the Zend/zend_alloc.c, Zend/zend_execute_API.c,Zend/zend_strtod.c, Zend/zend_virtual_cwd.c, Zend/zend_vm_def.h, ext/opcache/Optimizer/* and /fastcgi.c sections.

I'm not sure about ext/dom/, ext/bcmath/libbcmath/src/, ext/date/lib/, ext/gd/libgd/, ext/mbstring/libmbfl/, ext/mbstring/ucgendat/, ext/pdo/pdo_dbh.c, ext/zip/lib/, sapi/fpm/

@kaplanlior
Copy link
Contributor Author

Thanks @dstogov , files excluded.

@kaplanlior
Copy link
Contributor Author

The builds looks OK, although the status is failed.

@@ -453,26 +453,3 @@ void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi)
time->sse_uptodate = 1;
time->have_relative = time->relative.have_weekday_relative = time->relative.have_special_relative = 0;
}

#if 0
int main(void)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like test code, may have sense to keep it.

@pierrejoye
Copy link
Contributor

Just keep it pls.

Many codes are helper or ideas. Yes we could pit them in wiki and such but in lined is better and easier to find for contributors.

@smalyshev
Copy link
Contributor

In general, I'd avoid messing with any library that is merged into php source from other places.

@@ -72,43 +72,6 @@ struct rusage

/* Page faults */
zend_long ru_majflt;
#if 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this one is too much as as well. These are prepared things which are not yet supported on Windows. But please let them stay there.

@kaplanlior
Copy link
Contributor Author

First, I really appreciate the reviews. I've done quite a few reverts to exclude the parts you've asked.

@krakjoe
Copy link
Member

krakjoe commented Jan 1, 2017

There seems to be a strong consensus that we should not be doing this, I'm closing the PR.

@krakjoe krakjoe closed this Jan 1, 2017
@nikic
Copy link
Member

nikic commented Jan 1, 2017

I think most of the non-library removals have also landed in the meantime (at least I remember doing a bunch of these)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants