[cfe-commits] r72760 - in /cfe/trunk: include/clang/AST/Builtins.def test/Sema/vfprintf-invalid-redecl.c test/Sema/vfprintf-valid-redecl.c

Eli Friedman eli.friedman at gmail.com
Wed Jun 3 02:54:55 PDT 2009


Author: efriedma
Date: Wed Jun  3 04:54:50 2009
New Revision: 72760

URL: http://llvm.org/viewvc/llvm-project?rev=72760&view=rev
Log:
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.)


Added:
    cfe/trunk/test/Sema/vfprintf-invalid-redecl.c
    cfe/trunk/test/Sema/vfprintf-valid-redecl.c
Modified:
    cfe/trunk/include/clang/AST/Builtins.def

Modified: cfe/trunk/include/clang/AST/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Builtins.def?rev=72760&r1=72759&r2=72760&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Builtins.def (original)
+++ cfe/trunk/include/clang/AST/Builtins.def Wed Jun  3 04:54:50 2009
@@ -356,7 +356,7 @@
 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")
 

Added: cfe/trunk/test/Sema/vfprintf-invalid-redecl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vfprintf-invalid-redecl.c?rev=72760&view=auto

==============================================================================
--- cfe/trunk/test/Sema/vfprintf-invalid-redecl.c (added)
+++ cfe/trunk/test/Sema/vfprintf-invalid-redecl.c Wed Jun  3 04:54:50 2009
@@ -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}}

Added: cfe/trunk/test/Sema/vfprintf-valid-redecl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vfprintf-valid-redecl.c?rev=72760&view=auto

==============================================================================
--- cfe/trunk/test/Sema/vfprintf-valid-redecl.c (added)
+++ cfe/trunk/test/Sema/vfprintf-valid-redecl.c Wed Jun  3 04:54:50 2009
@@ -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();





More information about the cfe-commits mailing list