Re: ISO C3X proposal: nonnull qualifier

2021-12-02 Thread Joseph Myers
On Thu, 2 Dec 2021, Alejandro Colomar (man-pages) via Gcc wrote: > So, now this can be made non-flow-sensitive, which was a big concern. And now > the biggest concern I can see is that this qualifier works opposite to const > (here discarding is allowed but not adding it), and that is contrary to

Re: ISO C3X proposal: nonnull qualifier

2021-12-02 Thread Alejandro Colomar (man-pages) via Gcc
On 12/2/21 21:24, Alejandro Colomar (man-pages) wrote: #define nonnull_assign(nn, p) \ ({    \     auto p_  = p; \     auto nn_ = nn;    \

Re: ISO C3X proposal: nonnull qualifier

2021-12-02 Thread Alejandro Colomar (man-pages) via Gcc
On 11/16/21 13:34, Alejandro Colomar (man-pages) wrote: $ cat _Nonnull.c #include int *_Nonnull f(int *_Nullable p) { if (!p)     exit(1); return p; } int *_Nonnull g(int *_Null_unspecified p) { return p; } int *_Nonnull h(int *p) { return p; } int *_Nullable i(in

Re: ISO C3X proposal: nonnull qualifier

2021-11-16 Thread Alejandro Colomar (man-pages) via Gcc
Hi, Sorry for Clang people, when I started this thread, I wasn't subscribed to your list, and some messages are not on your list. You can find the complete thread on the GCC list: I have a few questions for you. See below, please. On

Re: ISO C3X proposal: nonnull qualifier

2021-11-16 Thread Alejandro Colomar (man-pages) via Gcc
Hi Joseph, On 11/15/21 23:47, Joseph Myers wrote: On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: Hi Joseph, On 11/15/21 23:17, Joseph Myers wrote: On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: How is restrict handling that problem of lvalue-to-rvalue

Re: ISO C3X proposal: nonnull qualifier

2021-11-16 Thread Jonathan Wakely via Gcc
On Mon, 15 Nov 2021, 21:15 Alejandro Colomar (man-pages) wrote: > My intention is that the final PDF to be sent to the committee > will have those diffs. > But I have no clue of how to do that kind of things, > so for an initial draft to discuss on, > before even presenting it to the committee, >

Re: ISO C3X proposal: nonnull qualifier

2021-11-15 Thread Joseph Myers
On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: > Hi Joseph, > > On 11/15/21 23:17, Joseph Myers wrote: > > On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: > > > > > How is restrict handling that problem of lvalue-to-rvalue already? > > > > restrict has trick

Re: ISO C3X proposal: nonnull qualifier

2021-11-15 Thread Alejandro Colomar (man-pages) via Gcc
Hi Joseph, On 11/15/21 23:17, Joseph Myers wrote: On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: How is restrict handling that problem of lvalue-to-rvalue already? restrict has tricky rules about "based on" (6.7.3.1). Hmm, I think I can "base on" that, to define what I h

Re: ISO C3X proposal: nonnull qualifier

2021-11-15 Thread Joseph Myers
On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: > How is restrict handling that problem of lvalue-to-rvalue already? restrict has tricky rules about "based on" (6.7.3.1). -- Joseph S. Myers jos...@codesourcery.com

Re: ISO C3X proposal: nonnull qualifier

2021-11-15 Thread Alejandro Colomar (man-pages) via Gcc
Hi Joseph, On 11/15/21 21:18, Joseph Myers wrote: lvalue-to-rvalue conversion loses qualifiers, which makes any rules based on whether the RHS of an assignment was nonnull-qualified very problematic. (The specification of restrict is exceedingly tricky and very unlikely to be a good basis for s

Re: ISO C3X proposal: nonnull qualifier

2021-11-15 Thread Joseph Myers
lvalue-to-rvalue conversion loses qualifiers, which makes any rules based on whether the RHS of an assignment was nonnull-qualified very problematic. (The specification of restrict is exceedingly tricky and very unlikely to be a good basis for specifying any other feature.) I don't think a man

Re: ISO C3X proposal: nonnull qualifier

2021-11-15 Thread Alejandro Colomar (man-pages) via Gcc
Hi, On 11/15/21 5:01 PM, Alejandro Colomar (man-pages) wrote: > Hi all, > > I'd like to propose the following feature for ISO C (and also ISO C++). > It is based on a mix of GCC's [[gnu::nonnull]] and Clang's _Nonnull, > with a pinch of salt of mine. > > I'd like to get some feedback from GCC an