On Thu, 11 Oct 2018, Wilco Dijkstra wrote: > For the new math functions all errno handling is already done in a > single function so you could do something like: if (want_errno) > set_errno (error).
want_errno being a global (or TLS) variable gets into the same problems as _LIB_VERSION; you want something that's a property of the particular call to the function, based on the options used to compile that call (which gets you into either wrappers, or building selected functions twice to provide no-errno-setting entry point, if you want to be able to optimize on the basis that a call cannot change errno). Saving and restoring seems a plausible approach if you want to e.g. provide a guarantee in future glibc versions that complex.h functions will not set errno (they'd need review to see if at present they can actually call any error cases of other functions that might set errno, or if there isn't a problem anyway). -- Joseph S. Myers jos...@codesourcery.com