"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,
// 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);
}
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;
}