<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Aug 17, 2009, at 3:27 AM, Duncan Sands wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br><blockquote type="cite">+/* LLVM LOCAL begin */<br></blockquote><blockquote type="cite">+/* Don't use ill-defined extern-inline-with-non-inline-definition<br></blockquote><blockquote type="cite">+ */<br></blockquote><blockquote type="cite">+#if 0<br></blockquote><blockquote type="cite"> #if GCC_VERSION < 3004 || !defined (__cplusplus)<br></blockquote><br>does this mean that llvm-gcc can no longer be built with gcc before<br>gcc-3.4?  Also, do you understand why the test checks<br>"defined (__cplusplus)"?<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>My understanding of <<a href="http://www.greenend.org.uk/rjk/2003/03/inline.html">http://www.greenend.org.uk/rjk/2003/03/inline.html</a>> is that "static inline" is universally valid and should work for all versions of gcc and clang.</div><div><div><br></div><br><blockquote type="cite"><div><blockquote type="cite">+/* LLVM LOCAL begin */<br></blockquote><blockquote type="cite">+/* Use static inline for exact_log2/floor_log2 */<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> /* Return log2, or -1 if not exact.  */<br></blockquote><blockquote type="cite">-extern int exact_log2                  (unsigned HOST_WIDE_INT);<br></blockquote><blockquote type="cite">+static inline int exact_log2                  (unsigned HOST_WIDE_INT);<br></blockquote><blockquote type="cite">  /* Return floor of log2, with -1 for zero.  */<br></blockquote><blockquote type="cite">-extern int floor_log2                  (unsigned HOST_WIDE_INT);<br></blockquote><blockquote type="cite">+static inline int floor_log2                  (unsigned HOST_WIDE_INT);<br></blockquote><br>Probably these should only be defined if the same test as above holds<br>(GCC_VERSION < 3004 ...).  In which case you wouldn't need the static<br>inline changes for this bit.<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>No, the original source code has an "extern" prototype unconditionally, and then for newer GCC's adds an extern inline definition underneath it:</div><div><br></div><div><div>/* Return floor of log2, with -1 for zero.  */</div><div>extern int floor_log2                  (unsigned HOST_WIDE_INT);</div><div><br></div><div>/* Inline versions of the above for speed.  */</div><div>#if GCC_VERSION >= 3004</div><div><br></div><div>I guess we could eliminate the "extern" prototype" and unconditionally convert the "extern inline" to a "static inline" in the header. Also, what's the preferred way to delete code that's present in gcc 4.2.1? Is it with #if 0, or delete the code block outright?</div><div><br></div><br><blockquote type="cite"><div>Ciao,<br><br>Duncan.<br></div></blockquote></div><br></body></html>