On Sun, Feb 15, 2009 at 10:06 AM, Douglas Gregor <[email protected]> wrote: > > On Feb 14, 2009, at 8:19 PM, Daniel Dunbar wrote: > >> On Sat, Feb 14, 2009 at 5:43 PM, Chris Lattner <[email protected]> wrote: >>> >>> On Feb 14, 2009, at 11:32 AM, Daniel Dunbar wrote: >>> >>>>> >>>>> I guess it is bad that we don't accept some programs we used to, but is >>>>> this >>>>> really such a bad thing? If this just affects stuff in llvm-test, I'm >>>>> inclined to just fix the programs. If this occurs in some large C code >>>>> bases, then perhaps we should try to be more lenient. >>>> >>>> I'm just concerned about the number of such programs. It seems like >>>> there might be a good tradeoff in allowing some limited but common >>>> patterns of redefinition which are "safe", with the same diagnostic >>>> perhaps but as a warning. This would still put pressure on the user >>>> but at least allow the code to compile. This seems relatively easy for >>>> us to do, what is the downside? >>> >>> The problem is that clients of the AST can't make the assumption that a >>> builtin with a specified ID has the expected prototype. GCC doesn't >>> provide >>> this guarantee so all sorts of code has to check that printf has at least >>> 1 >>> argument etc. It is really annoying and leads to crash-on-invalid bugs. >> >> Sorry, I guess I wasn't clear. >> >> I wasn't saying we should allow the invalid prototype. I think we >> should just treat it as a warning instead of an error in some cases >> (maybe even all), and the effect will be that we just ignore the >> declaration in the code. I'm certainly not proposing we create >> ill-formed AST nodes. > > What if the invalid declaration is also a definition? Do we just skip over > the entire body?
I would say, in that case reject it and mention that the user may want -ffreestanding. - Daniel _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
