diff options
author | Matt Joyce <matthew.joyce@embedded-brains.de> | 2022-01-18 10:13:04 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-13 06:55:41 +0200 |
commit | f3b8138239d3ba34c4ecaa4305b0fbd7eb4e28a5 (patch) | |
tree | 80cc7a629134d4568bf5dc71898266555a6863b0 /newlib/libc/machine/powerpc | |
parent | d0d78e96ebf4187fb9362465f1a397680447046f (diff) | |
download | newlib-f3b8138239d3ba34c4ecaa4305b0fbd7eb4e28a5.zip newlib-f3b8138239d3ba34c4ecaa4305b0fbd7eb4e28a5.tar.gz newlib-f3b8138239d3ba34c4ecaa4305b0fbd7eb4e28a5.tar.bz2 |
Add _REENT_ERRNO(ptr)
Add a _REENT_ERRNO() macro to encapsulate the access to the
_errno member of struct reent. This will help to replace the
structure member with a thread-local storage object in a follow
up patch.
Replace uses of __errno_r() with _REENT_ERRNO(). Keep __errno_r() macro for
potential users outside of Newlib.
Diffstat (limited to 'newlib/libc/machine/powerpc')
-rw-r--r-- | newlib/libc/machine/powerpc/strtosfix16.c | 10 | ||||
-rw-r--r-- | newlib/libc/machine/powerpc/strtosfix32.c | 10 | ||||
-rw-r--r-- | newlib/libc/machine/powerpc/strtosfix64.c | 10 | ||||
-rw-r--r-- | newlib/libc/machine/powerpc/strtoufix16.c | 10 | ||||
-rw-r--r-- | newlib/libc/machine/powerpc/strtoufix32.c | 10 | ||||
-rw-r--r-- | newlib/libc/machine/powerpc/strtoufix64.c | 10 |
6 files changed, 30 insertions, 30 deletions
diff --git a/newlib/libc/machine/powerpc/strtosfix16.c b/newlib/libc/machine/powerpc/strtosfix16.c index 3fba454..5475de8 100644 --- a/newlib/libc/machine/powerpc/strtosfix16.c +++ b/newlib/libc/machine/powerpc/strtosfix16.c @@ -108,10 +108,10 @@ _strtosfix16_r (struct _reent *rptr, { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + _REENT_ERRNO(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return SHRT_MIN; return SHRT_MAX; @@ -120,12 +120,12 @@ _strtosfix16_r (struct _reent *rptr, /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return SHRT_MAX; } else if (dbl.d < -1.0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return SHRT_MIN; } @@ -152,7 +152,7 @@ _strtosfix16_r (struct _reent *rptr, /* check if positive saturation has occurred because of rounding */ if (!sign && result < 0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return SHRT_MAX; } } diff --git a/newlib/libc/machine/powerpc/strtosfix32.c b/newlib/libc/machine/powerpc/strtosfix32.c index b21de9e..6941be5 100644 --- a/newlib/libc/machine/powerpc/strtosfix32.c +++ b/newlib/libc/machine/powerpc/strtosfix32.c @@ -29,10 +29,10 @@ _strtosfix32_r (struct _reent *rptr, { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + _REENT_ERRNO(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return LONG_MIN; return LONG_MAX; @@ -41,12 +41,12 @@ _strtosfix32_r (struct _reent *rptr, /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return LONG_MAX; } else if (dbl.d < -1.0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return LONG_MIN; } @@ -75,7 +75,7 @@ _strtosfix32_r (struct _reent *rptr, /* check if positive saturation has occurred because of rounding */ if (!sign && result < 0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return LONG_MAX; } } diff --git a/newlib/libc/machine/powerpc/strtosfix64.c b/newlib/libc/machine/powerpc/strtosfix64.c index 1603212..9da3ffa 100644 --- a/newlib/libc/machine/powerpc/strtosfix64.c +++ b/newlib/libc/machine/powerpc/strtosfix64.c @@ -32,10 +32,10 @@ _strtosfix64_r (struct _reent *rptr, { if (ld_type == 1) { - rptr->_errno = EDOM; + _REENT_ERRNO(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; if (word0(ldbl) & Sign_bit) return LONG_LONG_MIN; return LONG_LONG_MAX; @@ -63,7 +63,7 @@ _strtosfix64_r (struct _reent *rptr, { if (exp > 0 || (exp == 0 && tmp != 0x8000000000000000LL)) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return LONG_LONG_MIN; } } @@ -71,7 +71,7 @@ _strtosfix64_r (struct _reent *rptr, { if (exp >= 0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return LONG_LONG_MAX; } } @@ -88,7 +88,7 @@ _strtosfix64_r (struct _reent *rptr, /* check if positive saturation has occurred because of rounding */ if (!sign && result < 0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return LONG_LONG_MAX; } } diff --git a/newlib/libc/machine/powerpc/strtoufix16.c b/newlib/libc/machine/powerpc/strtoufix16.c index 9b16268..415652d 100644 --- a/newlib/libc/machine/powerpc/strtoufix16.c +++ b/newlib/libc/machine/powerpc/strtoufix16.c @@ -106,10 +106,10 @@ _strtoufix16_r (struct _reent *rptr, { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + _REENT_ERRNO(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return 0; return USHRT_MAX; @@ -118,12 +118,12 @@ _strtoufix16_r (struct _reent *rptr, /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return USHRT_MAX; } else if (dbl.d < 0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return 0; } @@ -147,7 +147,7 @@ _strtoufix16_r (struct _reent *rptr, if (negexp == 0) { /* we have overflow which means saturation */ - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return USHRT_MAX; } result |= (1 << (16 - negexp)); diff --git a/newlib/libc/machine/powerpc/strtoufix32.c b/newlib/libc/machine/powerpc/strtoufix32.c index 7d03f8c..4340c71 100644 --- a/newlib/libc/machine/powerpc/strtoufix32.c +++ b/newlib/libc/machine/powerpc/strtoufix32.c @@ -28,10 +28,10 @@ _strtoufix32_r (struct _reent *rptr, { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + _REENT_ERRNO(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return 0; return ULONG_MAX; @@ -40,12 +40,12 @@ _strtoufix32_r (struct _reent *rptr, /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return ULONG_MAX; } else if (dbl.d < 0) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return 0; } @@ -77,7 +77,7 @@ _strtoufix32_r (struct _reent *rptr, /* if rounding causes carry, then saturation has occurred */ if (result < tmp) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return ULONG_MAX; } } diff --git a/newlib/libc/machine/powerpc/strtoufix64.c b/newlib/libc/machine/powerpc/strtoufix64.c index a2f0484..2057068 100644 --- a/newlib/libc/machine/powerpc/strtoufix64.c +++ b/newlib/libc/machine/powerpc/strtoufix64.c @@ -31,10 +31,10 @@ _strtoufix64_r (struct _reent *rptr, { if (ld_type == 1) { - rptr->_errno = EDOM; + _REENT_ERRNO(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; if (word0(ldbl) & Sign_bit) return 0; return ULONG_LONG_MAX; @@ -60,14 +60,14 @@ _strtoufix64_r (struct _reent *rptr, /* check for saturation */ if (sign) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return 0; } else { if (exp > 0 || (exp == 0 && tmp >= 0x8000000000000000LL)) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return ULONG_LONG_MAX; } } @@ -89,7 +89,7 @@ _strtoufix64_r (struct _reent *rptr, /* if rounding causes carry, then saturation has occurred */ if (result < tmp) { - rptr->_errno = ERANGE; + _REENT_ERRNO(rptr) = ERANGE; return ULONG_LONG_MAX; } } |