[llvm-commits] [llvm-gcc-4.2] r49171 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp

Dale Johannesen dalej at apple.com
Sun Apr 6 12:48:01 PDT 2008


On Apr 6, 2008, at 10:57 AM, Chris Lattner wrote:

> On Apr 6, 2008, at 1:32 AM, Duncan Sands wrote:
>>> Right.  However, I think that this should be handled in the linker.
>>> When llvm-link'ing together a function prototype with anything  
>>> else (a
>>> prototype or definition) the possibility of throwing should always  
>>> win
>>> (in other words "resultnothrow = proto1nothrow & proto2nothrow").   
>>> If
>>> we did this, I don't think there would be a problem.
>>
>> There indeed wouldn't be a problem.  But what I don't understand is  
>> why
>> you guys think it makes sense to mark declarations of external  
>> functions
>> nounwind (because of !flag_exceptions) in the first place.
>
> Duncan beat me over the head on IRC, explaining that this is  
> basically what the nounwind flag is for on *calls*.  He points out  
> that -fno-exceptions really means that a) no *calls* can throw in  
> the current translation unit and b) no *function definitions* can  
> throw.
>
> Marking function prototypes as nothrow and then fixing it up in the  
> linker is more complicated and doesn't provide any value.  Dale,  
> what do you think?

I think a point I made earlier has gotten lost:  it is not possible to  
handle this without changing the linker.
No matter what you do in the compiler, you can create cases where a  
function is marked unwind in some
files and nounwind in other files.  The linker must know how to deal  
with that.  The sensible way to deal with it, IMO, is for the  
definition to win, which means the setting on the declarations is  
irrelevant (unless you want to warn when they don't match, and  
apparently you don't.)  To me it does not make sense for the setting  
on the calls and the declarations not to match, so I'd leave it this  
way.

Also I am not interpreting -fno-exceptions the same way he is (much of  
the difficulty here is the vague descriptions provided in the gcc  
docs).   I think it means "this file does not have to deal with the  
possibility that exceptions get thrown".




More information about the llvm-commits mailing list