aboutsummaryrefslogtreecommitdiff
path: root/libgcc/fixed-bit.c
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-08-26 09:43:32 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-08-26 15:29:03 +0100
commit1b0b969df794d0401ccb9279d44302d1e4729f15 (patch)
treecabdb1b04d535e5768e7531544ba3764c312f1a8 /libgcc/fixed-bit.c
parentdad2d3e003f1a9885cb1fa0f67baf50f62d57b06 (diff)
downloadgcc-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