-
Notifications
You must be signed in to change notification settings - Fork 1k
Use _RO accessors for const targets #7611
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7611 +/- ##
==========================================
- Coverage 99.02% 99.02% -0.01%
==========================================
Files 87 87
Lines 16903 16890 -13
==========================================
- Hits 16739 16726 -13
Misses 164 164 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No obvious timing issues in HEAD=ro-access Generated via commit 9b034c8 Download link for the artifact containing the test results: ↓ atime-results.zip
|
|
Another big class of cases where we could switch to There are roughly 240 such sites ( |
|
I see this has some (or total) overlap with #7394. I think it's good to break out the changes into minimally-digestible parts -- here we focus only on |
|
Should we add an accessor for #define INTEGER64_RO(x) ((const int64_t *) DATAPTR_RO(x)) |
Good point, though I think out of scope -- #7618 |
Co-authored-by: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com>
|
This Coccinelle spatch should at least help as a linter:
@@
type T;
const T *variable;
expression E;
@@
- variable = REAL(E)
+ variable = REAL_RO(E)
@@
type T;
const T *variable;
expression E;
@@
- variable = INTEGER(E)
+ variable = INTEGER_RO(E)
@@
type T;
const T *variable;
expression E;
@@
- variable = COMPLEX(E)
+ variable = COMPLEX_RO(E)
@@
type T;
const T *variable;
expression E;
@@
- variable = RAW(E)
+ variable = RAW_RO(E)
@@
type T;
const T *variable;
expression E;
@@
- variable = LOGICAL(E)
+ variable = LOGICAL_RO(E)
|
Co-authored-by: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com>
Keep the casts because they are currently necessary for the integer64 case.

Searched the sources:
grep -Er "const\b.*[*]\w+\s*=\s*[A-Z]+([^OR]|[^A]R)[(]" srcThis is some low-hanging fruit in terms of better use of read-only accessors. There will be other cases where we can make the change to a
constpointer as well, but those can't be identified with a simple regex.