summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2019-01-18 07:32:17 +0000
committerschwarze <>2019-01-18 07:32:17 +0000
commitf088490975411fdaef39d5aee455070b01b5440c (patch)
tree605e3717adf9d42d7e69449883b1199e84fdb429
parent0c5d69513c289e9ce0ad1d05ba2604b40af21910 (diff)
downloadopenbsd-f088490975411fdaef39d5aee455070b01b5440c.tar.gz
openbsd-f088490975411fdaef39d5aee455070b01b5440c.tar.bz2
openbsd-f088490975411fdaef39d5aee455070b01b5440c.zip
Replace the vague, incorrect, and confusing BUGS sections with CAVEATS
clearly stating which arguments have to be avoided, and mention the header files defining the constants required for the checks. Feedback and OK guenther@, OK bluhm@.
-rw-r--r--src/lib/libc/stdlib/abs.313
-rw-r--r--src/lib/libc/stdlib/imaxabs.313
-rw-r--r--src/lib/libc/stdlib/labs.319
3 files changed, 33 insertions, 12 deletions
diff --git a/src/lib/libc/stdlib/abs.3 b/src/lib/libc/stdlib/abs.3
index 420bdf6fdf..afacc985df 100644
--- a/src/lib/libc/stdlib/abs.3
+++ b/src/lib/libc/stdlib/abs.3
@@ -29,15 +29,16 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: abs.3,v 1.11 2013/07/17 05:42:11 schwarze Exp $ 32.\" $OpenBSD: abs.3,v 1.12 2019/01/18 07:32:17 schwarze Exp $
33.\" 33.\"
34.Dd $Mdocdate: July 17 2013 $ 34.Dd $Mdocdate: January 18 2019 $
35.Dt ABS 3 35.Dt ABS 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
38.Nm abs 38.Nm abs
39.Nd integer absolute value function 39.Nd integer absolute value function
40.Sh SYNOPSIS 40.Sh SYNOPSIS
41.In limits.h
41.In stdlib.h 42.In stdlib.h
42.Ft int 43.Ft int
43.Fn abs "int j" 44.Fn abs "int j"
@@ -66,5 +67,9 @@ The
66.Fn abs 67.Fn abs
67function first appeared in 68function first appeared in
68.At v6 . 69.At v6 .
69.Sh BUGS 70.Sh CAVEATS
70The absolute value of the most negative integer remains negative. 71The result of applying
72.Fn abs
73to
74.Dv INT_MIN
75is undefined.
diff --git a/src/lib/libc/stdlib/imaxabs.3 b/src/lib/libc/stdlib/imaxabs.3
index 6e280dda8a..340be61b6e 100644
--- a/src/lib/libc/stdlib/imaxabs.3
+++ b/src/lib/libc/stdlib/imaxabs.3
@@ -29,9 +29,9 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: imaxabs.3,v 1.7 2014/11/30 21:21:59 schwarze Exp $ 32.\" $OpenBSD: imaxabs.3,v 1.8 2019/01/18 07:32:17 schwarze Exp $
33.\" 33.\"
34.Dd $Mdocdate: November 30 2014 $ 34.Dd $Mdocdate: January 18 2019 $
35.Dt IMAXABS 3 35.Dt IMAXABS 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
@@ -39,6 +39,7 @@
39.Nd integer absolute value function 39.Nd integer absolute value function
40.Sh SYNOPSIS 40.Sh SYNOPSIS
41.In inttypes.h 41.In inttypes.h
42.In stdint.h
42.Ft intmax_t 43.Ft intmax_t
43.Fn imaxabs "intmax_t j" 44.Fn imaxabs "intmax_t j"
44.Sh DESCRIPTION 45.Sh DESCRIPTION
@@ -61,5 +62,9 @@ The
61.Fn imaxabs 62.Fn imaxabs
62function conforms to 63function conforms to
63.St -isoC-99 . 64.St -isoC-99 .
64.Sh BUGS 65.Sh CAVEATS
65The absolute value of the most negative integer remains negative. 66The result of applying
67.Fn imaxabs
68to
69.Dv INTMAX_MIN
70is undefined.
diff --git a/src/lib/libc/stdlib/labs.3 b/src/lib/libc/stdlib/labs.3
index 37a20b42f3..f3fd6fd528 100644
--- a/src/lib/libc/stdlib/labs.3
+++ b/src/lib/libc/stdlib/labs.3
@@ -29,9 +29,9 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: labs.3,v 1.16 2017/08/01 14:57:02 schwarze Exp $ 32.\" $OpenBSD: labs.3,v 1.17 2019/01/18 07:32:17 schwarze Exp $
33.\" 33.\"
34.Dd $Mdocdate: August 1 2017 $ 34.Dd $Mdocdate: January 18 2019 $
35.Dt LABS 3 35.Dt LABS 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
@@ -40,6 +40,7 @@
40.Nm qabs 40.Nm qabs
41.Nd return the absolute value of a long integer 41.Nd return the absolute value of a long integer
42.Sh SYNOPSIS 42.Sh SYNOPSIS
43.In limits.h
43.In stdlib.h 44.In stdlib.h
44.Ft long 45.Ft long
45.Fn labs "long i" 46.Fn labs "long i"
@@ -73,5 +74,15 @@ and
73.Fn llabs 74.Fn llabs
74functions conform to 75functions conform to
75.St -isoC-99 . 76.St -isoC-99 .
76.Sh BUGS 77.Sh CAVEATS
77The absolute value of the most negative integer remains negative. 78The results of applying
79.Fn labs
80to
81.Dv LONG_MIN
82and
83.Fn llabs
84to
85.Dv LLONG_MIN
86are undefined, and
87.Fn qabs
88is not portable in the first place.