<div dir="ltr"><div>per 7.1.4p1:</div><div><br></div><div> The use of #undef to remove any macro definition will also ensure that an actual function is referred to</div><div><br></div><div>And then footnote 187:</div><div><br></div><div>Because external identifiers and some macro names beginning with an underscore are reserved, implementations may provide special semantics for such names. For example, the identifier _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the appropriate header could specify:</div><div><br></div><div>#define abs(x) __builtin_abs(x)</div><div><br></div><div>for a compiler whose code generator will accept it.</div><div><br></div><div>In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine function may write</div><div><br></div><div>#undef abs</div><div><br>whether the implementation’s header provides a macro implementation of abs or a built-in implementation. The prototype for the function, which precedes and is hidden by any macro definition, is thereby revealed also.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 7, 2016 at 4:38 PM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 7 June 2016 at 13:24, Ryan Taylor via llvm-dev<br>
<span><<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Not sure why it's called TargetLibraryInfo if it's not in target specific<br>
> code? It seems that ALL targets use this code, making it generic. Am I<br>
> missing something here?<br>
<br>
</span>Some of the names can vary by platform, for example ARM sometimes has<br>
__aeabi_memcpy instead of memcpy<br>
<span><br>
> ps. The spec also states (albeit unclearly) that you can use "#undef" to<br>
> omit a library function so that a user defined function of the same name can<br>
> be used but LLVM doesn't seem to support that.<br>
<br>
</span>I think it says exactly the opposite: (7.1.2p3):<br>
<br>
"If the program removes (with #undef) any macro definition of an<br>
identifier in the first group listed above, the behavior is<br>
undefined."<br>
<br>
Incidentally, I don't think anyone's mentioned that "-ffreestanding"<br>
will probably inhibit the intrinsics substantially if that's what<br>
you're after (technically, it's probably a compiler extension that it<br>
gives them back to the user, but everyone does it as far as I know).<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>