diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-11-02 23:19:09 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-11-03 14:27:26 -0400 |
commit | 8cb2c7fc2ea4b40494b9be0f446bfbb2e52e057d (patch) | |
tree | 73e59f17c0e01f14c6978310cd5acac5dc934ffb /gdb/python | |
parent | dbbfabb441556497f3ee9d89cf74bdc4a7a4c83c (diff) | |
download | gdb-8cb2c7fc2ea4b40494b9be0f446bfbb2e52e057d.zip gdb-8cb2c7fc2ea4b40494b9be0f446bfbb2e52e057d.tar.gz gdb-8cb2c7fc2ea4b40494b9be0f446bfbb2e52e057d.tar.bz2 |
gdbsupport: mark array_view::slice with [[nodiscard]]
I (almost) had a bug where I did:
buffer.slice (...)
but I meant:
buffer = buffer.slice (...)
The first one does nothing, it creates a new array_view but without
using it, it's useless. Mark the slice methods with [[nodiscard]]
(which is standard C++17) so that error would generate a warning.
I guess that many functions could be marked as nodiscard, essentially
function that is pure (doesn't have side-effects). But this one seems
particularly easy to mis-use.
Change-Id: Ib39a0a65a5728a3cfd68a02ae31635810baeaccb
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python')
0 files changed, 0 insertions, 0 deletions