Am 28.07.2013 um 01:08 schrieb John McCall:

> It’s going to generate crashing code anyway.  You can’t statically detect 
> that the user’s using this feature — you’d, what, add code to the compiler 
> that detects that the user has defined forwardingTargetForSelector: in a way 
> that might accept a selector that you think probably has an indirect return?

Of course the compiler can't verify it, but that's not the point. The point is 
that there is a way to check if forwarding structs would work. If not, you can 
disable a feature that requires forwarding. E.g. an application might only 
enable its remote support if it can be sure that forwarding structs would not 
crash.

> The only way that this preprocessing check is useful at all is if the user’s 
> reaction to this is “Oh, I can't upgrade my compiler; I’ll just add 
> workarounds every time I run into this crash, but I want to disable them when 
> the runtime feature is enabled.”  And that might be a rational reaction, but 
> it’s a rational reaction to *any possible compiler bug*.

That's almost the idea. The idea is that the developer can check at compile 
time if struct forwarding works or not and if not #error out. That's still 
better than code being deployed and suddenly crashing! It can advise the user 
to update the compiler. Or if only an optional feature depends on it just 
disable that optional feature.

> I think that exposing the value of -fobjc-runtime as preprocessor state is a 
> pretty reasonable request, although I don’t see how it solves this problem at 
> all.

I added an __OBJFW_RUNTIME__ define similar to __NEXT_RUNTIME__ that defines 
the version as 0xMMNN, where MM is the major and NN the minor of the version. 
What I did notice is that -fobjc-runtime=objfw-100000 can theoretically be 
specified by the user (which would of course set the define to nonsense). 
However, this is not the real problem, IMHO: Clang should error out if the 
specified version is higher than the maximum supported version. Is this not 
done intentionally or is the code for that just not written yet?

Please review my attached patch and commit it if it is acceptable.

Attachment: 0001-Add-a-define-for-the-ObjFW-runtime-ABI-version.patch
Description: Binary data

--
Jonathan
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to