-
Task
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
-
13
-
Foundations Sprint 99, Foundation Sprint 100, Foundation Sprint 101, Foundations Sprint 102, Foundation Sprint 103, Foundation Sprint 104, Foundation Sprint 105, Foundation Sprint 106, Foundation Sprint 107, Foundation Sprint 108, Foundation Sprint 109, Foundation Sprint 110, Foundation Sprint 111, Foundation Sprint 112, Foundation Sprint 113, Foundation Sprint 114, Foundation Sprint 115, Foundation Sprint 116, Foundation Sprint 117, Foundation Sprint 118, Foundation Sprint 119, Foundation Sprint 120, Foundation Sprint 121, Foundation Sprint 122, Foundation Sprint 123, Foundation Sprint 124, Foundation Sprint 125, Foundation Sprint 126, Foundation Sprint 127, Foundation Sprint 128, Foundation Sprint 129, Foundation Sprint 130, Foundation Sprint 131, Foundation Sprint 132, Foundation Sprint 133, Foundation Sprint 134, Foundation Sprint 135, Foundation Sprint 136, Foundation Sprint 137, Foundation Sprint 138, Foundation Sprint 139, Foundation Sprint 140, Foundation Sprint 141
The idea behind QTBUG-100485 and QTBUG-100486 is:
The idea behind the Q_CONSTINIT and constexpr epics was to mark every static and thread_local variable constexpr, if it can be. Failing that, mark it Q_CONSTINIT const. Failing that, mark it as Q_CONSTINIT. Failing that, mark it as intended dynamic initialization (where we're still missing a standard marker for this).
Then have Clazy or similar do static checks and complain about unmarked statics or thread_locals.
Along the way, try to bring variables into higher categories.
I acknowledge that a Q_CONSTINIT variable may still be expensive to destruct, and therefore construct, because of the required registration of the dtor with the runtime, but we shouldn't let the perfect be the enemy of the good here. Don't try to be clever with PODs and Core Generalized Constant Expressions. These are things for the compiler to check, not for reviewers and other code readers to fuss about. The job of the developer is to express intent, which means exactly one of constexpr, constinit, or Q_DYNINIT(?) should be marking up every static or thread_local variable. No exceptions.
(quote from mmutz)
Providing a clang-tidy modernizer will help to automate marking everything that can be constexpr with constexpr.
- is required for
-
QTBUG-100485 Make all objects of static storage-duration that can be constexpr be constexpr [QtBase]
-
- Open
-
For Gerrit Dashboard: QTBUG-106650 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
603632,4 | WIP Clang-tidy check for constexpr thread_local | release_19.1.0-based | clang/llvm-project | Status: NEW | -2 | 0 |