This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Decorate string_view members with nonnull attribute


On 14/06/18 20:02 +0300, Ville Voutilainen wrote:
On 14 June 2018 at 19:57, Jonathan Wakely <jwakely@redhat.com> 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 libstdc++ and have to use __attribute__
instead.

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 valid would
fail to compile, and we'd be a non-conforming implementation.

We can use __attribute__(__nonnull__)) so that we accept those
programs (and be a conforming implementation). Why would we choose to
be non-conforming when we don't have to?

We can use [[gnu::__nonnull__]] but that would still reject programs
that #define gnu so maybe we want the front-end to also recognise
__gnu__ as our attribute namespace.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]