[SERVER-75815] Add [[gsl::Pointer]] attribute to class StringData Created: 06/Apr/23 Updated: 29/Oct/23 Resolved: 07/Apr/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Matt Broadstone |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Server Serverless 2023-04-17 |
| Participants: |
| Description |
|
The presence of this attribute allows the compiler to catch dangling references. std::string_view has this annotation. we should follow suit. "This ensures that constructing a StringPiece (StringData in our case) from a temporary (xvalue) https://bugs.chromium.org/p/chromium/issues/detail?id=1282468
https://godbolt.org/z/Kdoec79ar |
| Comments |
| Comment by Githook User [ 07/Apr/23 ] |
|
Author: {'name': 'Matt Broadstone', 'email': 'mbroadst@mongodb.com', 'username': 'mbroadst'}Message: |
| Comment by Billy Donahue [ 06/Apr/23 ] |
|
should be behind a compiler-selective macro as gcc doesn't know about this attribute and annoyingly complains [-Wattributes] about unknown attributes instead of just ignoring them like it's required to. |