[LLVMdev] [RFC] New function attributes for errno-setting functions

Krzysztof Parzyszek kparzysz at codeaurora.org
Fri Sep 13 14:09:20 PDT 2013


On 9/13/2013 3:37 PM, Hal Finkel wrote:
>
> No, I don't think so. If sqrt is not readnone or readonly, then it should potentially alias whatever the errno macro actually expands to (whether it is a global variable, and thread-local variable, a function call, or whatever).

I'm not sure about this. How about this:

extern int BLAH;
#define errno BLAH

Then we have

   int fd = open(...);
   int saved_errno = BLAH;
   double s = sqrt(var);

If "sqrt" is "write-only-errno", how would we know that BLAH should be 
aliased with sqrt?  We don't to alias it with every global variable 
(that's what this proposal is trying to address).  We'd need a way to 
associate BLAH with errno, or else we're in the same place as we are now.

-K


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list