<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Looks like there is policy to not issue diagnostics on not yet introduced methods<div>(grep for <span style="color: rgb(49, 89, 93); font-family: Menlo; font-size: 11px;">AR_NotYetIntroduced in clang). So you need to handle this </span></div><div><font color="#31595d" face="Menlo"><span style="font-size: 11px;">yourself by making the call to </span></font><span style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">Decl</span><span style="font-family: Menlo; font-size: 11px;">::getAvailability.</span></div><div><font face="Menlo"><span style="font-size: 11px;">- Fariborz</span></font></div><div><font face="Menlo"><span style="font-size: 11px;"><br></span></font><div><div>On Dec 13, 2014, at 10:08 AM, AlexDenisov <<a href="mailto:1101.debian@gmail.com">1101.debian@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">Well, I started implementation of warnings regarding availability and faced with an issue:</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">I decided to check how clang behaves and what kind of diagnostics it shows in that situation, </div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">but I've found that clang just compiles the code without any warnings.</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">I've run this command:</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">clang main.m -fsyntax-only -fmodules -Weverything</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">with this code:</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">//main.m</div><div id="bloop_customfont" style="margin: 0px;"><div id="bloop_customfont" style="margin: 0px;">@import Foundation;</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">@interface Future : NSObject</div><div id="bloop_customfont" style="margin: 0px;">+ (instancetype)newFuture __attribute__((availability(macosx,introduced=10.10)));</div><div id="bloop_customfont" style="margin: 0px;">@end</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">@implementation Future</div><div id="bloop_customfont" style="margin: 0px;">+ (instancetype)newFuture { return nil; }</div><div id="bloop_customfont" style="margin: 0px;">@end</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">int main(int argc, const char * argv[]) {</div><div id="bloop_customfont" style="margin: 0px;">  Future *f = [Future newFuture];</div><div id="bloop_customfont" style="margin: 0px;">  return f == nil;</div><div id="bloop_customfont" style="margin: 0px;">}</div></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">And everything was just fine (excerpt of unused variables argc/argv).</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">So the question is: what is expected behaviour regarding boxed expressions and availability?</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">I can’t even find such tests for NSNumber/NSString.</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">I would appreciate any suggestions or advice.</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">Best regards, Alex.</div><div id="bloop_sign_1418493320057667072" class="bloop_sign"><div style="font-family: helvetica, arial; font-size: 13px;">-- <br>AlexDenisov</div><div style="font-family: helvetica, arial; font-size: 13px;">Software Engineer, <a href="https://github.com/AlexDenisov">https://github.com/AlexDenisov</a></div></div><br><p style="">On 11 Dec 2014 at 22:12:06, AlexDenisov (<a href="mailto:1101.debian@gmail.com">1101.debian@gmail.com</a>) wrote:</p><blockquote type="cite" class="clean_bq"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">> there is a good chance we won’t be adding boxing of pointers. </div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">Do you mean pointers to void (valueWithPointer) or all the pointers, like NSObject * (valueWithNonretainedObject)?</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;">Anyway, should I get rid of that functionality before submitting updated patch or keep it and, probably, drop later?</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><br></div><div id="bloop_sign_1418332207474221056" class="bloop_sign"><div style="font-family: helvetica, arial; font-size: 13px;">-- <br>AlexDenisov</div><div style="font-family: helvetica, arial; font-size: 13px;">Software Engineer, <a href="https://github.com/AlexDenisov">https://github.com/AlexDenisov</a></div></div><br><p style="">On 10 Dec 2014 at 23:00:38, jahanian (<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>) wrote:</p><blockquote type="cite" class="clean_bq"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><span><br class=""></span><div><blockquote type="cite" class=""><div class=""><span>On Dec 9, 2014, at 12:21 AM, AlexDenisov <<a href="mailto:1101.debian@gmail.com" class="">1101.debian@gmail.com</a>> wrote:</span></div><div class=""><div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;"><span><br class=""></span><div id="bloop_customfont" class="" style="margin: 0px;"><span><br class=""></span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>>> Also, why can’t place this under the umbrella objc_boxed_expressions?</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span><br class=""></span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>Version 3.5, for example, supports objc_boxed_expression but not NSValue+boxed_expressions, </span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>which might cause weird compilation fails. Or did I get it wrong?</span></div></div></div></blockquote><span>No wrong :).</span></div><div><span><br class=""></span><blockquote type="cite" class=""><div class=""><div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;"><div id="bloop_customfont" class="" style="margin: 0px;"><span><br class=""></span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>+        // Otherwise, require a declaration of NSValue.</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>+        S.Diag(Loc, diag::err_undeclared_nsvalue);</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>+        return nullptr;</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>+      }</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>+    } else if (!S.NSValueDecl->hasDefinition()) {</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>+      S.Diag(Loc, diag::err_undeclared_nsvalue);</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span><br class=""></span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>>> Maybe we should have a clearer diagnostic here.</span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span><br class=""></span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>Makes sense, I used NSNumber' implementation here. I'd appreciate any suggestions or advice on </span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span>how to improve diagnostic here (and, probably, for NSNumber)</span></div></div></div></blockquote><div><span><br class=""></span></div><span>Probably should allude to NSValue (or NSNumber) having no definition (only forward declared).  </span></div><div><span>But, it is not something I strongly argue for.</span></div><div><span><br class=""></span></div><div><span>P.S. there is a good chance we won’t be adding boxing of pointers. </span></div><div><span><br class=""></span></div><div><span>Thanks, Fairborz</span></div></div></blockquote></div></div></span></blockquote></div></blockquote></div><br></div></body></html>