<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Heh, I see what you did there :-) Here are some options:</div><div class="gmail_quote"><br></div><div class="gmail_quote">  nonnull_param, required, notnull, dereferenceable</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, Feb 17, 2014 at 8:09 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Since this attribute hasn’t been available before in this position (except in GCC), I think exploring an alternate spelling is interesting.  What would you propose?</div>
<div><div class="h5"><div><br></div>On Feb 17, 2014, at 4:41 PM, Richard Smith <<a href="mailto:metafoo@gmail.com" target="_blank">metafoo@gmail.com</a>> wrote:<br><div><br><blockquote type="cite">Yeah, I think that'd mostly work. But be careful about this case:<div>
<br></div><div>template<typename T></div><div>void f(T *p __attribute__((nonnull))) {</div><div>  p(0); // #1<br></div><div>}</div><div>void g() { f<void(int *q)>(0); } // #2</div>
<div><br></div><div>Here again, GCC warns on #1 and Clang warns on #2. If we want to keep 'nonnull' as the spelling for this new thing, I think we should keep warning on #2. (But I do wonder if we should come up with a new name for this, rather than picking something that collides with an existing GCC attribute, even if only in corner cases.)</div>

<div><br><div>On Mon Feb 17 2014 at 4:21:49 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word"><div>+Ted.</div><div><br></div><div>I'm guessing we should stick with GCC's interpretation when the parameter is a function or block pointer, but maybe have a warning, and a fix-it for both possible interpretations.</div>

</div><div style="word-wrap:break-word"><div><br></div><div>Jordan</div></div><div style="word-wrap:break-word"><div><br></div><br><div><div>On Feb 17, 2014, at 15:52, Richard Smith <<a href="mailto:metafoo@gmail.com" target="_blank">metafoo@gmail.com</a>> wrote:</div>

<br><blockquote type="cite">This still seems to be GCC-incompatible. Per the GCC documentation, "__attribute__((nonnull))" on a pointer-to-function parameter means that all of *that* function's parameters can't be null. For instance:<br>


<br><div>void f(int (*p)(int *a, int *b) __attribute__((nonnull))) {</div><div>  if (p)</div><div>    p(0, 0); // #1</div><div>}</div><div>void g() { f(0); } // #2</div><div><br></div><div>GCC warns on line #1, Clang warns on line #2.</div>


<br><div>On Tue Feb 11 2014 at 9:40:01 AM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>> wrote:</div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


On Tue, Feb 11, 2014 at 12:37 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>> wrote:<br>
><br>
> On Feb 11, 2014, at 9:36 , Aaron Ballman <<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>> wrote:<br>
><br>
> +    if (D->getFunctionType()) {<br>
> +      handleNonNullAttr(S, D, Attr);<br>
> +    } else {<br>
> +      S.Diag(Attr.getLoc(), diag::warn_attribute_nonnull_<u></u>parm_no_args)<br>
> +        << D->getSourceRange();<br>
> +    }<br>
><br>
><br>
> Minor nit about the style -- shouldn't be using the curly braces here.<br>
><br>
><br>
> Uh...hm. I tried it without the curly braces, but it looked very strange<br>
> with the << dangling there. Should I add a dummy comment to justify it?<br>
<br>
I'm not too keen on dummy comments. If you think it's ugly without the<br>
braces, I'm fine with leaving them. :-)<br>
<br>
~Aaron<br>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
</blockquote>
</blockquote></div><br></div><div style="word-wrap:break-word"><br></div></blockquote></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div></div>