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

Schoedel, Kevin P kevin.p.schoedel at intel.com
Thu Sep 19 08:51:06 PDT 2013


> I don't know how feasible this is to roll out on linux or other platforms
> which may or may not have sympathetic libc maintainers.  Assuming they aren't
> sympathetic, you only have one less-great option IMO.  That is that you hack
> Clang to pattern match a well-known AST pattern into the
> __builtin_errno_address builtin.  For targets without a well-known pattern,
> it would never add the "does not touch errno" attribute.

Would it be practical to determine the pattern by recognizing the definition
(or declaration, pre-'11) of errno? The language standards impose strict
conditions it must meet:
- be defined (declared) within <errno.h> or <cerrno>;
- in C11 and C++11, be a macro;
- pre-'11, alternatively be an identifier with external linkage.

-- 
Kevin Schoedel, Software Developer, Intel of Canada
<kevin.p.schoedel at intel.com>      +1 (519) 772-2580





More information about the llvm-dev mailing list