]> granicus.if.org Git - clang/commitdiff
Remove the error about redefining library functions. It's causing too
authorDouglas Gregor <dgregor@apple.com>
Tue, 17 Feb 2009 16:03:01 +0000 (16:03 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 17 Feb 2009 16:03:01 +0000 (16:03 +0000)
much pain when compiling the Linux kernel (PR3592).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64767 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 3f7ad9a5caac3a1f2a1c8f97cba1be94bcdb8e0b..11db059c269ddfe972ca76416b00f0dd981c903b 100644 (file)
@@ -97,10 +97,6 @@ DIAG(warn_redecl_library_builtin, WARNING,
      "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,
index bf6a637ac264c1a62d0b31682646bcb454b9812d..b5e6bd6973987b3850ec2f984ff906ac526a9564 100644 (file)
@@ -2802,12 +2802,10 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclTy *D) {
 
   // 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);
index efaf3ed4553e3762497e08a32e7a14524dca4e58..4c28d8cf3eb55aaae90ea3aa9e77ead6f4c48cbb 100644 (file)
@@ -36,8 +36,6 @@ int f0() {
 }
 
 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;
 }