diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-08-26 09:43:32 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-08-26 15:29:03 +0100 |
commit | 1b0b969df794d0401ccb9279d44302d1e4729f15 (patch) | |
tree | cabdb1b04d535e5768e7531544ba3764c312f1a8 /libgcc/fixed-bit.c | |
parent | dad2d3e003f1a9885cb1fa0f67baf50f62d57b06 (diff) | |
download | gcc-1b0b969df794d0401ccb9279d44302d1e4729f15.zip gcc-1b0b969df794d0401ccb9279d44302d1e4729f15.tar.gz gcc-1b0b969df794d0401ccb9279d44302d1e4729f15.tar.bz2 |
libstdc++: Add nonnull to starts_with/ends_with/contains string members
Ideally this wouldn't be needed, because eventually these pointers all
get passed to either the basic_string_view(const CharT*) constructor, or
to basic_string_view::find(const CharT*), both of which already have the
attribute. But for that to work requires optimization, so that the null
value gets propagated through the call chain.
Adding it explicitly to each member that requires a non-null pointer
makes the diagnostics more reliable even without optimization. It's
better to give a diagnostic earlier anyway, at the actual problematic
call in the user's code.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (starts_with, ends_with, contains):
Add nonnull attribute.
* include/bits/cow_string.h (starts_with, ends_with, contains):
Likewise.
* include/std/string_view (starts_with, ends_with, contains):
Likewise.
* testsuite/21_strings/basic_string/operations/contains/nonnull.cc
* testsuite/21_strings/basic_string/operations/ends_with/nonnull.cc
* testsuite/21_strings/basic_string/operations/starts_with/nonnull.cc
* testsuite/21_strings/basic_string_view/operations/contains/nonnull.cc
* testsuite/21_strings/basic_string_view/operations/ends_with/nonnull.cc
* testsuite/21_strings/basic_string_view/operations/starts_with/nonnull.cc
Diffstat (limited to 'libgcc/fixed-bit.c')
0 files changed, 0 insertions, 0 deletions