]> granicus.if.org Git - clang/commitdiff
PR4290: Handle vfprintf in a way that doesn't give any diagnostics for
authorEli Friedman <eli.friedman@gmail.com>
Wed, 3 Jun 2009 09:54:50 +0000 (09:54 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 3 Jun 2009 09:54:50 +0000 (09:54 +0000)
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

include/clang/AST/Builtins.def
test/Sema/vfprintf-invalid-redecl.c [new file with mode: 0644]
test/Sema/vfprintf-valid-redecl.c [new file with mode: 0644]

index 671c4bd6cd4a3d40bc95a6ef8aae3a4ac0d6e226..11f3264faa2d23e3820e38f858ec7a27880e0ae8 100644 (file)
@@ -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 (file)
index 0000000..02c5061
--- /dev/null
@@ -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 (file)
index 0000000..cc8e2c4
--- /dev/null
@@ -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();