diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-06-03 09:54:50 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-06-03 09:54:50 +0000 |
commit | c4db24a96d062b2d3fb1f46c28a75ed728b00030 (patch) | |
tree | 23df565522838ecf186f0d6e4e29ee32681ad65c | |
parent | 51e774d42269e3b22d746184c0b9076fc13b32e6 (diff) |
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
-rw-r--r-- | include/clang/AST/Builtins.def | 2 | ||||
-rw-r--r-- | test/Sema/vfprintf-invalid-redecl.c | 6 | ||||
-rw-r--r-- | test/Sema/vfprintf-valid-redecl.c | 6 |
3 files changed, 13 insertions, 1 deletions
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(); |