[cfe-commits] r64767 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaDecl.cpp test/Sema/implicit-builtin-decl.c

Douglas Gregor dgregor at apple.com
Tue Feb 17 08:03:01 PST 2009


Author: dgregor
Date: Tue Feb 17 10:03:01 2009
New Revision: 64767

URL: http://llvm.org/viewvc/llvm-project?rev=64767&view=rev
Log:
Remove the error about redefining library functions. It's causing too
much pain when compiling the Linux kernel (PR3592).

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Sema/implicit-builtin-decl.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def?rev=64767&r1=64766&r2=64767&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Tue Feb 17 10:03:01 2009
@@ -97,10 +97,6 @@
      "incompatible redeclaration of library function %0 will be ignored")
 DIAG(err_builtin_definition, ERROR,
      "definition of builtin function %0")
-DIAG(err_builtin_lib_definition, ERROR,
-     "definition of library function %0 in a hosted implementation")
-DIAG(note_builtin_lib_def_freestanding, NOTE,
-     "use -ffreestanding to compile as a freestanding implementation")
 
 /// parser diagnostics
 DIAG(ext_typedef_without_a_name, EXTWARN,

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=64767&r1=64766&r2=64767&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Feb 17 10:03:01 2009
@@ -2802,12 +2802,10 @@
 
   // Builtin functions cannot be defined.
   if (unsigned BuiltinID = FD->getBuiltinID(Context)) {
-    if (Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) {
-      Diag(FD->getLocation(), diag::err_builtin_lib_definition) << FD;
-      Diag(FD->getLocation(), diag::note_builtin_lib_def_freestanding);
-    } else 
+    if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) {
       Diag(FD->getLocation(), diag::err_builtin_definition) << FD;
-    FD->setInvalidDecl();
+      FD->setInvalidDecl();
+    }
   }
 
   PushDeclContext(FnBodyScope, FD);

Modified: cfe/trunk/test/Sema/implicit-builtin-decl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/implicit-builtin-decl.c?rev=64767&r1=64766&r2=64767&view=diff

==============================================================================
--- cfe/trunk/test/Sema/implicit-builtin-decl.c (original)
+++ cfe/trunk/test/Sema/implicit-builtin-decl.c Tue Feb 17 10:03:01 2009
@@ -36,8 +36,6 @@
 }
 
 void * realloc(void *p, int size) { // expected-warning{{incompatible redeclaration of library function 'realloc' will be ignored}} \
-// expected-note{{'realloc' is a builtin with type 'void *(void *, unsigned long)'}} \
-// expected-error{{definition of library function 'realloc' in a hosted implementation}} \
-  // expected-note{{use -ffreestanding to compile as a freestanding implementation}}
+// expected-note{{'realloc' is a builtin with type 'void *(void *, unsigned long)'}}
   return p;
 }





More information about the cfe-commits mailing list