On 2/18/2013 6:45 PM, Chris Lattner wrote:> > In the context of LTO, it makes sense for the attribute to be on function bodies, not on prototypes.What if the body is defined in some external library? -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
On Feb 18, 2013, at 5:16 PM, Krzysztof Parzyszek <kparzysz at codeaurora.org> wrote:> On 2/18/2013 6:45 PM, Chris Lattner wrote: >> >> In the context of LTO, it makes sense for the attribute to be on function bodies, not on prototypes. > > What if the body is defined in some external library?That code is presumably compiled by someone. If whoever compiles it specifies -fno-builtin, the attribute would be added to it. It doesn't affect its clients. -Chris
On 2/18/2013 8:08 PM, Chris Lattner wrote:> > That code is presumably compiled by someone. If whoever compiles it specifies -fno-builtin, the attribute would be added to it. It doesn't affect its clients.I thought that no-builtin attached to foo means that foo should not be considered a builtin function. For example, if someone wrote their own printf, they may want to mark it as no-builtin so that the compiler doesn't assume it's the printf from libc. What does it mean in LLVM? -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
On 2/18/2013 8:08 PM, Chris Lattner wrote:> > That code is presumably compiled by someone. If whoever compiles it specifies -fno-builtin, the attribute would be added to it. It doesn't affect its clients.After reading the description quoted by Bill, I'm not sure what you mean by attaching the attribute to the function body. Suppose I have my own version of strlen, written in whatever language and present in an .o file, and a function foo in C which calls strlen, which is compiled with clang. It makes sense to put the "nobuiltin" attribute on the prototype of "strlen", since this way all the callers of the strlen would know what they are dealing with. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation