[cfe-commits] r64504 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ lib/AST/ lib/Analysis/ lib/CodeGen/ lib/Sema/ test/Analysis/ test/CodeGen/ test/Sema/

Daniel Dunbar daniel at zuster.org
Sat Feb 14 20:19:51 PST 2009


On Sat, Feb 14, 2009 at 5:43 PM, Chris Lattner <clattner at apple.com> 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.

 - Daniel



More information about the cfe-commits mailing list