r290146 - Fix completely bogus types for some builtins:

Friedman, Eli via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 17:00:51 PST 2016


On 12/19/2016 3:59 PM, Richard Smith via cfe-commits wrote:
> Author: rsmith
> Date: Mon Dec 19 17:59:34 2016
> New Revision: 290146
>
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vfprintf-valid-redecl.c?rev=290146&r1=290145&r2=290146&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/vfprintf-valid-redecl.c (original)
> +++ cfe/trunk/test/Sema/vfprintf-valid-redecl.c Mon Dec 19 17:59:34 2016
> @@ -1,16 +1,18 @@
>   // RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
>   // RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify -DPREDECLARE
> -// expected-no-diagnostics
>   
>   #ifdef PREDECLARE
>   // PR16344
>   // Clang has defined 'vfprint' in builtin list. If the following line occurs before any other
>   // `vfprintf' in this file, and we getPreviousDecl()->getTypeSourceInfo() on it, then we will
>   // get a null pointer since the one in builtin list doesn't has valid TypeSourceInfo.
> -int vfprintf(void) { return 0; }
> +int vfprintf(void) { return 0; } // expected-warning {{requires inclusion of the header <stdio.h>}}
>   #endif
>   
>   // PR4290
>   // The following declaration is compatible with vfprintf, so we shouldn't
> -// warn.
> +// reject.
>   int vfprintf();
> +#ifndef PREDECLARE
> +// expected-warning at -2 {{requires inclusion of the header <stdio.h>}}
> +#endif

We shouldn't warn here; this declaration of vfprintf() is compatible 
with the actual prototype.  (Granted, you can't call vfprintf() without 
including stdio.h, but that's a separate problem.)

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the cfe-commits mailing list