(master) kdrive: parentheses around macro argument symbols#2940
Open
metux wants to merge 1 commit into
Open
Conversation
For safety, add extra parantheses on each used macro argument. In most cases not strictly necessary, but better have some strict and automatically enforcable policy here than wasting time on judging individual cases. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
stefan11111
reviewed
Jun 9, 2026
| dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v) | ||
| #define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen) | ||
| dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, (v)) | ||
| #define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv((pScreen)) |
Contributor
There was a problem hiding this comment.
Function parentheses already serve as parentheses.
stefan11111
reviewed
Jun 9, 2026
| #define OFF(x) ((x)%BITS_PER_LONG) | ||
| #define LONG(x) ((x)/BITS_PER_LONG) | ||
| #define BIT(x) (1 << OFF(x)) | ||
| #define BIT(x) (1 << OFF((x))) |
Contributor
There was a problem hiding this comment.
Function/Macro parentheses already serve as parentheses.
stefan11111
reviewed
Jun 9, 2026
| #endif | ||
|
|
||
| #define AtomFromName(x) MakeAtom(x, strlen(x), 1) | ||
| #define AtomFromName(x) MakeAtom((x), strlen((x)), 1) |
Contributor
There was a problem hiding this comment.
Function/Macro parentheses already serve as parentheses.
stefan11111
reviewed
Jun 9, 2026
| } | ||
|
|
||
| #define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin)) | ||
| #define KdScreenOrigin(pScreen) (&(KdGetScreenPriv((pScreen))->screen->origin)) |
Contributor
There was a problem hiding this comment.
Function/Macro parentheses already serve as parentheses.
Contributor
|
@metux Macros are a very fragile thing. You can't just add parentheses treewide and hope for the best. |
metux
added a commit
that referenced
this pull request
Jun 9, 2026
metux
added a commit
that referenced
this pull request
Jun 9, 2026
metux
added a commit
that referenced
this pull request
Jun 9, 2026
metux
added a commit
that referenced
this pull request
Jun 9, 2026
metux
added a commit
that referenced
this pull request
Jun 9, 2026
metux
added a commit
that referenced
this pull request
Jun 10, 2026
For safety, add extra parantheses on each used macro argument. In most cases not strictly necessary, but better have some strict and automatically enforcable policy here than wasting time on judging individual cases. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
metux
added a commit
that referenced
this pull request
Jun 10, 2026
For safety, add extra parantheses on each used macro argument. In most cases not strictly necessary, but better have some strict and automatically enforcable policy here than wasting time on judging individual cases. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
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.
For safety, add extra parantheses on each used macro argument.
In most cases not strictly necessary, but better have some strict
and automatically enforcable policy here than wasting time on
judging individual cases.
Signed-off-by: Enrico Weigelt, metux IT consult info@metux.net