Re: [PATCH 5/5] libm: Control errno support with _IEEE_LIBM configuration parameter

Keith Packard via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Corinna Vinschen via Newlib <[email protected]> writes:

> This math stuff is a bit over my head.  IIUC, the default is
> NOT setting _IEEE_LIBM, which results in the defauklt behaviour
> today.  That's what I care most about: Not introducing backward
> incompatible settings into Cygwin.

TL;DR summary:

The only effect on Cygwin will be to enable errno reporting for the few
functions coming from libm/math.

Longer discussion:

There are a lot of inter-related standards and I feel like I'm
down the rabbit hole on a lot of this. I think this particular issue can
be understood at a fairly high level as one of identifying inconsistent
semantics across the math library and then trying to identify ways to
fix that.

The new math code (libm/common) has errno enabled unless you set
WANT_ERRNO=0 (which no included configuration does).

The old math code (libm/math) has the errno code compiled-in unless you
define _IEEE_LIBM (which no configuration does). When _IEEE_LIBM is
defined, most (but not all) of the errno-setting code is removed.
However, the errno code in libm/math is also controlled by a run-time
conditional, _LIB_VERSION, which blocks the errno behavior *unless* the
global variable _LIB_VERSION is set to _POSIX_, which is not the default
on anything other than the spu build.

So, the current Cygwin behavior has most functions always setting errno
(those from libm/common), but some functions (those from libm/math) only
setting errno if the application happens to know about _LIB_VERSION and
sets that to _POSIX_.

This patch tries to simplify things so that one single global
compile-time define, _IEEE_LIBM, controls whether errno is ever modified
by the math library, and removes the run-time behavior controlled by
_LIB_VERSION.

-- 
-keith
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl8q1x4ACgkQ2yIaaQAA
ABFvBA//bios0mARaw3COwMWhyub8OkhzAK5V9Be01+uh9c/YUJ6ssRMVuJ3VDTL
E/Omc/bA81neV7hwx/dVSuqyKxs/P14J88ZL/kGXQz/Co2wuHhiJpa9tHhd9029A
7Renfln6OoB7VPzZyZJAx/mCw8aOagwiRagsxz+q1yKHVN+5FOTSM7txzUC9i6tJ
VSb64nBpNOQBtnUH2+0jrgo4myNz652dg8hwV9JzyH0y97y9vcqXDdzbuQGsPxdA
b2C+8gEHdLyoAyUSsI61dWadtxlZ4x+wLMoIOWSTSjEVsDuWT+J07slRsMjVDYLD
l4XkfZUVLk6HDvJa+tkdhOv6LxOV2i8nAbfiV3YOF9wROVM4AJ9ihHFV+3CDqnc/
q9BcsL1rKOPx5XsBo7/RpLRyJAGcTwAWfxi02kWgtSnxf6oB7wB04XbwRhU97ffC
xdE5CwVYKLe7uZu9uGkXCfLv6m5qcGg2or8uoFkFRmzaEqGBWyLGkvQb2cTmW/uX
2E9z20SLz1SS4Q6lt+U+ikz9HKA3pw0RdPq9IGxp9aUmLr92HOTAH6V5WHkDHa14
kpEo9X67zykH786wIEazI/I6XQCFFcfC70bsHdb9alGfw9Vj38ci8VsxMrVuTle5
UoycyAF8MYy6DEisM8/IJsr0R4Pc7ZJiXIbae+SOnOzVA8FBHfg=
=xCmJ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.