Skip to content

[DNM] c++: showcase gen_defines.py macro expansion issue #86770

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

Closed
wants to merge 1 commit into from

Conversation

pillo79
Copy link
Collaborator

@pillo79 pillo79 commented Mar 7, 2025

This PR showcases the issue fixed by #86758; it is the first commit of that series.

This test case is meant to test the use of preprocessor macros that
paste together a number from devicetree with a suffix, like UINT32_C.
The test case is expected to fail because the C++ preprocessor does not
elide comments added by gen_dts_defines.py before expanding the macros,
resulting in errors like the following:

  error: pasting "/* 0x2 */" and "U" does not give
         a valid preprocessing token

or, in this synthetic test case:

  error: unable to find numeric literal operator 'operator""UU'

when accessing values from the devicetree_generated.h header file.

Signed-off-by: Luca Burelli <[email protected]>
@pillo79
Copy link
Collaborator Author

pillo79 commented Mar 12, 2025

Closing after additional investigation as I have identified the actual cause - a nested macro expansion fixed by arduino/ArduinoCore-zephyr@1eade10 . Nothing related to C++. 🤦‍♂️

@pillo79 pillo79 closed this Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant