Skip to content

Fix dictifyCPPDEFINES handling of macro strings - #4329

Merged
bdbaddog merged 3 commits into
SCons:masterfrom
mwichmann:bug/scan-dict-convert
Mar 27, 2023
Merged

bdbaddog merged 3 commits into
SCons:masterfrom
mwichmann:bug/scan-dict-convert

Conversation

@mwichmann

Copy link
Copy Markdown
Collaborator

CPPDEFINES can contain name=value strings, either a single one, or one or more in a sequence type. After conversion (subsequent Append/Prepend to CPPDEFINES), these will be stored as tuples, but it is possible to hit cases where the type conversion has never been triggered. The C Scanner has its own routine to process CPPDEFINES, and missed these cases, which are now handled.

The testcases in issue 4193 which showed this problem are now included in the C scanner unit tests, and the test for dictifyCPPDEFINES is expanded to check these two forms.

Fixes #4193

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt (and read the README.rst)
  • I have updated the appropriate documentation

CPPDEFINES can contain name=value strings, either a single one, or one or
more in a sequence type.  After conversion (subsequent Append/Prepend to
CPPDEFINES), these will be stored as tuples, but it is possible to hit
cases where the type conversion has never been triggered. The C Scanner
has its own routine to process CPPDEFINES, and missed these cases,
which are now handled.

The testcases in issue 4193 which showed this problem are now included
in the C scanner unit tests, and the test for dictifyCPPDEFINES is
expanded to check these two forms.

Fixes SCons#4193

Signed-off-by: Mats Wichmann <[email protected]>
* Single-tuple CPPDEFINES was not handled.
* Add some more unit tests.
* Add some comments - that we need to keep in sync with processDefines,
  but don't actually call it (the routine *could* be rewritten to process
  the result of processDefines instead of the bare CPPDEFINES, but
  currently doesn't do that).

Signed-off-by: Mats Wichmann <[email protected]>
@bdbaddog bdbaddog changed the title Fix dictifyCPPDEFINES handlong of macro strings Fix dictifyCPPDEFINES handling of macro strings Mar 26, 2023
Comment thread CHANGES.txt

- Whatever John Doe did.
From Mats Wichmann
- C scanner's dictifyCPPDEFINES routine did not understand the possible

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add a blurb to RELEASE.txt as well.

@bdbaddog
bdbaddog merged commit c80cbb0 into SCons:master Mar 27, 2023
@mwichmann mwichmann added this to the NextRelease milestone Apr 11, 2023
@mwichmann
mwichmann deleted the bug/scan-dict-convert branch April 11, 2023 15:55
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.

CConditionalScanner does not detect included header from a command line macro

2 participants