8000 Wrap some multi-line macros in ``do { ... } while(0)`` in ``symtable.c`` · Issue #119981 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Wrap some multi-line macros in do { ... } while(0) in symtable.c #119981

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
picnixz opened this issue Jun 3, 2024 · 3 comments
Closed

Wrap some multi-line macros in do { ... } while(0) in symtable.c #119981

picnixz opened this issue Jun 3, 2024 · 3 comments
Labels
type-feature A feature request or enhancement

Comments

@picnixz
Copy link
Member
picnixz commented Jun 3, 2024

Feature or enhancement

Proposal:

While I was implementing #119976, I observed that some macros are not guarded against possible constructions because their content is only wrapped in {} but not in the classical do { ... } while(0) construction.

For instance, the current VISIT macro sometimes requires the semi-colon and sometimes not depending on how it is used, which I find a bit confusing. I think it's preferrable to always require to add the ;.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

@sobolevn
Copy link
Member
sobolevn commented Jun 3, 2024

There are similar patterns in compile.c, maybe it is also worth taking a look? 🤔

@picnixz
Copy link
Member Author
picnixz commented Jun 3, 2024

Yes, that's a good idea. Since I was going offline in a few minutes, could you either close this issue or edit the title so that we can perhaps track other files?

@sobolevn
Copy link
Member
sobolevn commented Jun 3, 2024

I prefer to open new ones for each piece of work :)
Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants
0