Hi Doug, A few technical comments:
On Fri, Feb 13, 2009 at 3:20 PM, Douglas Gregor <[email protected]> wrote: > +BUILTIN(alloca, "v*z", "f:stdlib.h") > +BUILTIN(calloc, "v*zz", "f:stdlib.h") > +BUILTIN(malloc, "v*z", "f:stdlib.h") + realloc ? > +DIAG(note_previous_builtin_declaration, NOTE, > + "%0 was implicitly declared here with type %1") This warning is lying, it wasn't implicitly declared here! What about: "%0 is a builtin with type %1" > @@ -491,9 +509,12 @@ > diag::kind PrevDiag; > if (Old->isThisDeclarationADefinition()) > PrevDiag = diag::note_previous_definition; > - else if (Old->isImplicit()) > - PrevDiag = diag::note_previous_implicit_declaration; > - else > + else if (Old->isImplicit()) { > + if (Old->getBuiltinID()) > + PrevDiag = diag::note_previous_builtin_declaration; > + else > + PrevDiag = diag::note_previous_implicit_declaration; > + } else > PrevDiag = diag::note_previous_declaration; I think we need to do a bit more than this. This code will allow merging of compatible declarations and reuse the new declaration not the old one. I think we probably want to merely require the declarations to be compatible, but make sure that we always use the original builtin declaration. Currently this is causing problems in IRgen with: -- void *malloc(); void f0() { malloc(10); } -- because the redeclaration of malloc is shadowing the original declaration, yet the builtin ID is still set so IRgen expects the prototype to match exactly to that of the builtin. - Daniel _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
