fix: keep explicit empty value in -D definitions - #64
Merged
Conversation
`-DFOO=` now defines FOO to nothing, as clang does, instead of 1. Only a bare `-DFOO` becomes `FOO=1`. Also simplifies `__init__.py`: removes the unreachable `except` blocks in `_append_definition`, prints the promised warning for a missing include directory, and drops some redundant code in `main`. Assisted-by: ClaudeCode:claude-fable-5
henryiii
marked this pull request as draft
August 6, 2026 18:18
henryiii
marked this pull request as ready for review
August 7, 2026 13:00
leakec
approved these changes
Aug 7, 2026
leakec
left a comment
Collaborator
There was a problem hiding this comment.
Excellent, this looks good to me. No changes to suggest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This seems oddly intentional; the new version does seem better, but was there a reason for the old one?
🤖 AI text below 🤖
Addresses finding 7 and the
__init__.pysimplifications from the review in #59.-DFOO=(explicit empty value) kept an empty value, as clang does. Before, it becameFOO=1. A bare-DFOOstill becomesFOO=1._append_definition: removed the two unreachableexceptblocks (str.partitiondoes not raiseValueError) and simplified the function._append_include_dir: prints the warning for a missing directory that the docstring promises, instead of doing nothing.main: plain tuple unpacking forparse_known_args,extend(parsed_args.header), and no more redundantint(width)(argparse usestype=int).A parametrized regression test for
_append_definitionis included.