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

Modules/expat/xmlparse.c warning about unreachable code #112796

Closed
ronaldoussoren opened this issue Dec 6, 2023 · 4 comments
Closed

Modules/expat/xmlparse.c warning about unreachable code #112796

ronaldoussoren opened this issue Dec 6, 2023 · 4 comments
Labels
build The build process and cross-build extension-modules C modules in the Modules dir topic-XML type-bug An unexpected behavior, bug, or error

Comments

@ronaldoussoren
Copy link
Contributor

ronaldoussoren commented Dec 6, 2023

Bug report

Bug description:

The code linked to below disables some code by using if (0 && ...) and that results in a compile time warning.

https://github.com/python/cpython/blob/00cce0fe495ee820cd3ca5878bdbe3dd65b1be7b/Modules/expat/xmlparse.c#L3102C19-L3118

Given that the code has been disabled single 2019 it should be safe to just remove this block, or disable the code by using #if 0 with a comment when it is prudent to keep the code around.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

@ronaldoussoren ronaldoussoren added type-bug An unexpected behavior, bug, or error extension-modules C modules in the Modules dir build The build process and cross-build topic-XML labels Dec 6, 2023
ronaldoussoren added a commit to ronaldoussoren/cpython that referenced this issue Dec 7, 2023
This removes two blocks of code from expat/xmlparse.c
that were disabled by turning them into ``if(0 && ...)``
blocks.

This code has been inactive since 2019 and can be revived
from the repository when it is needed again.
ronaldoussoren added a commit to ronaldoussoren/cpython that referenced this issue Dec 7, 2023
@ronaldoussoren
Copy link
Contributor Author

I've closed the PR because I noticed (thanks to one of the CI jobs) that Modules/expat is a vendored copy of expat. I haven't found any documentation on updates to this vendored copy, but its probably better to just leave it as is.

@hartwork
Copy link
Contributor

@ronaldoussoren this is libexpat/libexpat#692 upstream and syncing CPython's copy of Expat to 2.6.0 will get this fixed "for free". On a side note, the idea there is to keep compiling that code which ifdef'ing it out would not do.

@hartwork
Copy link
Contributor

There is dedicated issue #115399 on the upgrade to 2.6.0 now.

@ronaldoussoren
Copy link
Contributor Author

I'm closing this issue, resolving #115399 will also fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build extension-modules C modules in the Modules dir topic-XML type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants