From: Eli Friedman Date: Wed, 3 Jun 2009 09:54:50 +0000 (+0000) Subject: PR4290: Handle vfprintf in a way that doesn't give any diagnostics for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4db24a96d062b2d3fb1f46c28a75ed728b00030;p=clang PR4290: Handle vfprintf in a way that doesn't give any diagnostics for valid declarations and doesn't give an error for autoconf-style invalid redeclarations. This isn't quite ideal, but I don't see any other way easy way to handle it. (The only thing I can think of that's reasonably general is adding a new builtin type FILETy which is only compatible with a type equivalent to FILE, and that seems like overkill.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72760 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Builtins.def b/include/clang/AST/Builtins.def index 671c4bd6cd..11f3264faa 100644 --- a/include/clang/AST/Builtins.def +++ b/include/clang/AST/Builtins.def @@ -356,7 +356,7 @@ LIBBUILTIN(fprintf, "iP*cC*.", "fp:1:", "stdio.h") LIBBUILTIN(snprintf, "ic*zcC*.", "fp:2:", "stdio.h") LIBBUILTIN(sprintf, "ic*cC*.", "fp:1:", "stdio.h") LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h") -LIBBUILTIN(vfprintf, "iP*cC*a", "fP:1:", "stdio.h") +LIBBUILTIN(vfprintf, "i.", "fP:1:", "stdio.h") LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h") LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h") diff --git a/test/Sema/vfprintf-invalid-redecl.c b/test/Sema/vfprintf-invalid-redecl.c new file mode 100644 index 0000000000..02c5061d8c --- /dev/null +++ b/test/Sema/vfprintf-invalid-redecl.c @@ -0,0 +1,6 @@ +// RUN: clang-cc %s -fsyntax-only -verify +// PR4290 + +// The following declaration is not compatible with vfprintf(), but make +// sure this isn't an error: autoconf expects this to build. +char vfprintf(); // expected-warning {{incompatible redeclaration of library function 'vfprintf'}} expected-note {{'vfprintf' is a builtin}} diff --git a/test/Sema/vfprintf-valid-redecl.c b/test/Sema/vfprintf-valid-redecl.c new file mode 100644 index 0000000000..cc8e2c40d3 --- /dev/null +++ b/test/Sema/vfprintf-valid-redecl.c @@ -0,0 +1,6 @@ +// RUN: clang-cc %s -fsyntax-only -pedantic -verify +// PR4290 + +// The following declaration is compatible with vfprintf, so we shouldn't +// warn. +int vfprintf();