Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-15 Thread Jonathan Wakely
On 14/06/18 17:51 +0100, Jonathan Wakely wrote: On 14/06/18 10:46 -0600, Martin Sebor wrote: On 06/13/2018 10:30 AM, Jonathan Wakely wrote: The C++ committee has confirmed that passing a null pointer to the unary basic_string_view constructor is undefined. This removes the check from our implem

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Martin Sebor
On 06/14/2018 10:54 AM, Ville Voutilainen wrote: On 14 June 2018 at 19:51, Jonathan Wakely wrote: On 14/06/18 10:46 -0600, Martin Sebor wrote: On 06/13/2018 10:30 AM, Jonathan Wakely wrote: The C++ committee has confirmed that passing a null pointer to the unary basic_string_view constructo

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Ville Voutilainen
On 14 June 2018 at 20:40, Jonathan Wakely wrote: >> Namely "For an attribute-token (including an attribute-scoped-token) >> not specified in this document, the behavior is >> implementation-defined.", aka [dcl.attr.grammar]/6. > > > As I said on IRC, if the user does > > #define gnu R"( > ,= ,-_-.

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Jonathan Wakely
On 14/06/18 20:27 +0300, Ville Voutilainen wrote: On 14 June 2018 at 20:21, Ville Voutilainen wrote: On 14 June 2018 at 20:08, Jonathan Wakely wrote: Oops, indeed. But for gnu-attributes, surely we can decide whatever we want about what's valid and what's not? We could say that #defining '

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Ville Voutilainen
On 14 June 2018 at 20:21, Ville Voutilainen wrote: > On 14 June 2018 at 20:08, Jonathan Wakely wrote: >>> Oops, indeed. But for gnu-attributes, surely we can decide whatever we >>> want about what's >>> valid and what's not? >> >> >> We could say that #defining 'nonnull' and/or 'gnu' as a macro i

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Ville Voutilainen
On 14 June 2018 at 20:08, Jonathan Wakely wrote: >> Oops, indeed. But for gnu-attributes, surely we can decide whatever we >> want about what's >> valid and what's not? > > > We could say that #defining 'nonnull' and/or 'gnu' as a macro is > undefined, but then programs that the standard says are

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Jonathan Wakely
On 14/06/18 20:02 +0300, Ville Voutilainen wrote: On 14 June 2018 at 19:57, Jonathan Wakely wrote: [macro.names]/2 forbids #defining macros with the same names as the standard attributes. The programs Martin shows as examples are not valid. But nonnull isn't a standard attribute though. So w

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Ville Voutilainen
On 14 June 2018 at 19:57, Jonathan Wakely wrote: >> [macro.names]/2 forbids #defining macros with the same names as the >> standard attributes. >> The programs Martin shows as examples are not valid. > > > But nonnull isn't a standard attribute though. So we can't use > [[gnu::xxx]] attributes in

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Jonathan Wakely
On 14/06/18 19:54 +0300, Ville Voutilainen wrote: On 14 June 2018 at 19:51, Jonathan Wakely wrote: On 14/06/18 10:46 -0600, Martin Sebor wrote: On 06/13/2018 10:30 AM, Jonathan Wakely wrote: The C++ committee has confirmed that passing a null pointer to the unary basic_string_view construct

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Ville Voutilainen
On 14 June 2018 at 19:51, Jonathan Wakely wrote: > On 14/06/18 10:46 -0600, Martin Sebor wrote: >> >> On 06/13/2018 10:30 AM, Jonathan Wakely wrote: >>> >>> The C++ committee has confirmed that passing a null pointer to the >>> unary basic_string_view constructor is undefined. This removes the che

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Jonathan Wakely
On 14/06/18 10:46 -0600, Martin Sebor wrote: On 06/13/2018 10:30 AM, Jonathan Wakely wrote: The C++ committee has confirmed that passing a null pointer to the unary basic_string_view constructor is undefined. This removes the check from our implementation, and adds the nonnull attribute to warn

Re: [PATCH] Decorate string_view members with nonnull attribute

2018-06-14 Thread Martin Sebor
On 06/13/2018 10:30 AM, Jonathan Wakely wrote: The C++ committee has confirmed that passing a null pointer to the unary basic_string_view constructor is undefined. This removes the check from our implementation, and adds the nonnull attribute to warn when the compiler can detect undefined input.