<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 13, 2010, at 2:50 PM, Charles Davis wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Douglas Gregor wrote:<br><blockquote type="cite">Hi Chip,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Jan 4, 2010, at 3:13 PM, Charles Davis wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Ping...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Patch is reattached, rebased against current TOT.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks for your patience; comments below.<br></blockquote>Sorry it took so long. Actually, the reason it took so long is that I<br>was on vacation :).<br><br>Anyway, latest patch reattached.<br></div></blockquote><div><br></div>Thanks!</div><div><br><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite">+static bool isCompatibleCallingConvention(CallingConv lcc,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">CallingConv rcc) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  // Here are the rules (as I see them) for compatibility of calling<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  // conventions:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  // - If they're the same, they're compatible.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  // - If the first one is not the default and the second one is, then<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  //   they're compatible (and the second declaration assumes the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">calling<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  //   convention of the first).<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  // - Otherwise, they're not compatible.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+  return (lcc == rcc || (lcc != CC_Default && rcc == CC_Default));<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+}<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The order dependency on lcc/rcc doesn't make sense to me, since the<br></blockquote><blockquote type="cite">definition of compatibility for types is commutative. I think the right<br></blockquote><blockquote type="cite">implementation for this function is to compare the canonical calling<br></blockquote><blockquote type="cite">conventions.<br></blockquote>As I said the case I had in mind is this one:<br><br>void __attribute__((stdcall)) f(void);<br>void f(void) {}<br><br>or the equivalent MSVC:<br><br>void __stdcall f(void);<br>void f(void) {}<br><br>MSVC lets you do that. Oddly enough, I found that GCC doesn't let you do<br>that. Apparently, clang already handles that, so my concern was<br>unfounded. (Is it?) So, I changed it to just directly compare the<br>calling conventions, like you said it should.<br></div></blockquote><div><br></div><div>I'd expect that the attribute is merged from the first declaration down to the second declaration, so this should work. </div><br><blockquote type="cite"><div><blockquote type="cite"><br></blockquote><blockquote type="cite">Aside from the canonical-types issue, I think this patch is ready to go<br></blockquote><blockquote type="cite">in. Do you have commit access?<br></blockquote>All right! ...But I don't have commit access yet. How do I get it? Or do<br>you intend to commit this yourself?<br></div></blockquote></div><div><br></div>I'll handle the first couple of commits, then we'll look into getting you direct commit access. I've committed this patch here:<br><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">      <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100118/026432.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100118/026432.html</a></span></div><div><br></div><div>With one change, because here we should be (and are now) comparing the canonical calling conventions:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">+static bool isSameCallingConvention(CallingConv lcc, CallingConv rcc) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">+  return (lcc == rcc);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">+}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">Thanks!</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div><span class="Apple-tab-span" style="white-space:pre">    </span>- Doug</div></div></body></html>