[PATCH] libstdc++: Add a __nonnnull__ attribute to std::string's _CharT* constructor

Jonathan Wakely jwakely@redhat.com
Sun Jun 28 21:16:45 GMT 2020


On 28/06/20 14:01 +0300, Ville Voutilainen via Libstdc++ wrote:
>On Sun, 28 Jun 2020 at 13:56, Ville Voutilainen
><ville.voutilainen@gmail.com> wrote:
>>
>> 2020-06-28  Ville Voutilainen  <ville.voutilainen@gmail.com>
>>
>>     Add a __nonnnull__ attribute to std::string's _CharT* constructor
>>     * include/bits/basic_string.h (string(_CharT*, const _Alloc&)):
>>     Add a __nonnull__ attribute.
>>     * testsuite/21_strings/basic_string/cons/char/nonnull.cc: New.
>>     * testsuite/21_strings/basic_string/cons/wchar_t/nonnull.cc: Likewise.
>
>
>Hmm, let's use dg-additional-options here too, and axe the pointless
>-std=gnu++11.

I agree the -std=gnu++11 isn't needed, but thre doesn't seem to be any
advantage to dg-additional-options here. The reason I suggested it for
th other tests was that it can take a target selector, so it can be
used to add options for some targets only (in the case of the variant
tests, only if the dialect is c++17 or later).

Here you want the -Wnonnull added unconditionally, with no target
selector, so dg-options works fine.

No big deal though, they work equivalently for this case.

OK for master, thanks.




More information about the Gcc-patches mailing list