[cfe-dev] What is the advantage of declaring a function (again) LIBBUILTIN ?
Richard Smith via cfe-dev
cfe-dev at lists.llvm.org
Wed Apr 6 10:50:05 PDT 2016
On Wed, Apr 6, 2016 at 5:48 AM, Nat! via cfe-dev <cfe-dev at lists.llvm.org>
wrote:
> In Builtins.def I see quite a few functions, which seem to "just"
> duplicate what is supposed to be in a header anyway.
>
> An example is "NSLogv":
>
> ```
> // void NSLogv(NSString *fmt, va_list args)
> LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG)
> ```
>
> and it's declared in Foundation/NSObjCRuntime as
>
> ```
> FOUNDATION_EXPORT void NSLogv(NSString *format, va_list args)
> NS_FORMAT_FUNCTION(1,0);
> ```
>
> Just the same. I don't get the benefit by this duplication.
This allows us to diagnose and recover from a missing inclusion of the
relevant header:
<stdin>:1:32: warning: implicitly declaring library function 'NSLogv' with
type 'void (id, struct __va_list_tag *)' [-Wimplicit-function-declaration]
void f(__builtin_va_list va) { NSLogv(@"foo %d", va); }
^
<stdin>:1:32: note: include the header <Foundation/NSObjCRuntime.h> or
explicitly provide a declaration for 'NSLogv'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160406/cfd5c67f/attachment.html>
More information about the cfe-dev
mailing list