Discussion:
random, random_r: update doc regarding Haiku
Add Reply
Bruno Haible
2017-10-29 07:39:41 UTC
Reply
Permalink
Raw Message
In a testdir on Haiku, I'm seeing these warnings:

In file included from ../../gltests/test-random.c:21:0:
../../gltests/test-random.c:25:18: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
SIGNATURE_CHECK (random, long, (void));
^
../../gltests/signature.h:46:58: note: in definition of macro 'SIGNATURE_CHECK2'
static ret (* _GL_UNUSED signature_check ## id) args = fn
^
../../gltests/signature.h:39:3: note: in expansion of macro 'SIGNATURE_CHECK1'
SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
^
../../gltests/test-random.c:25:1: note: in expansion of macro 'SIGNATURE_CHECK'
SIGNATURE_CHECK (random, long, (void));
^

In file included from ../../gltests/test-random_r.c:21:0:
../../gltests/test-random_r.c:23:18: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
SIGNATURE_CHECK (initstate_r, int, (unsigned int, char *, size_t,
^
../../gltests/signature.h:46:58: note: in definition of macro 'SIGNATURE_CHECK2'
static ret (* _GL_UNUSED signature_check ## id) args = fn
^
../../gltests/signature.h:39:3: note: in expansion of macro 'SIGNATURE_CHECK1'
SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
^
../../gltests/test-random_r.c:23:1: note: in expansion of macro 'SIGNATURE_CHECK'
SIGNATURE_CHECK (initstate_r, int, (unsigned int, char *, size_t,
^
../../gltests/test-random_r.c:25:18: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
SIGNATURE_CHECK (setstate_r, int, (char *, struct random_data *));
^
../../gltests/signature.h:46:58: note: in definition of macro 'SIGNATURE_CHECK2'
static ret (* _GL_UNUSED signature_check ## id) args = fn
^
../../gltests/signature.h:39:3: note: in expansion of macro 'SIGNATURE_CHECK1'
SIGNATURE_CHECK1 (fn, ret, args, __LINE__)
^
../../gltests/test-random_r.c:25:1: note: in expansion of macro 'SIGNATURE_CHECK'
SIGNATURE_CHECK (setstate_r, int, (char *, struct random_data *));
^

The prototypes are different:

POSIX: long random (void)
Haiku: int random (void)

glibc: int random_r (struct random_data *, int32_t *)
Haiku: int random_r (struct random_data *, int *)

glibc: int initstate_r (unsigned int, char *, size_t, struct random_data *)
Haiku: int initstate_r (unsigned int, void *, size_t, struct random_data *)

glibc: int setstate_r (char *, struct random_data *)
Haiku: int setstate_r (void *, struct random_data *)

Not worth fixing, I would say. Let me just update the documentation:


2017-10-29 Bruno Haible <***@clisp.org>

random, random_r: Mention different prototypes on Haiku.
* doc/posix-functions/random.texi: Mention different prototype on Haiku.
* doc/glibc-functions/random_r.texi: Likewise.
* doc/glibc-functions/initstate_r.texi: Likewise.
* doc/glibc-functions/setstate_r.texi: Likewise.

diff --git a/doc/posix-functions/random.texi b/doc/posix-functions/random.texi
index 88d36f9..29aa2f2 100644
--- a/doc/posix-functions/random.texi
+++ b/doc/posix-functions/random.texi
@@ -18,5 +18,5 @@ Portability problems not fixed by Gnulib:
@item
This function has a slightly incompatible declaration (the return type being
@samp{int} instead of @samp{long}) on some platforms:
-Cygwin 1.5.25.
+Cygwin 1.5.25, Haiku.
@end itemize
diff --git a/doc/glibc-functions/random_r.texi b/doc/glibc-functions/random_r.texi
index 67c8033..b0d1ec4 100644
--- a/doc/glibc-functions/random_r.texi
+++ b/doc/glibc-functions/random_r.texi
@@ -16,4 +16,8 @@ AIX 7.1, OSF/1 5.1.

Portability problems not fixed by Gnulib:
@itemize
+@item
+This function has a slightly different (but compatible) declaration on some
+platforms:
+Haiku 2017.
@end itemize
diff --git a/doc/glibc-functions/initstate_r.texi b/doc/glibc-functions/initstate_r.texi
index 868e1ef..c82f2cb 100644
--- a/doc/glibc-functions/initstate_r.texi
+++ b/doc/glibc-functions/initstate_r.texi
@@ -16,4 +16,8 @@ AIX 7.1, OSF/1 5.1.

Portability problems not fixed by Gnulib:
@itemize
+@item
+This function has a slightly different (but compatible) declaration on some
+platforms:
+Haiku 2017.
@end itemize
diff --git a/doc/glibc-functions/setstate_r.texi b/doc/glibc-functions/setstate_r.texi
index 7da17eb..27ada10 100644
--- a/doc/glibc-functions/setstate_r.texi
+++ b/doc/glibc-functions/setstate_r.texi
@@ -16,4 +16,8 @@ AIX 7.1, OSF/1 5.1.

Portability problems not fixed by Gnulib:
@itemize
+@item
+This function has a slightly different (but compatible) declaration on some
+platforms:
+Haiku 2017.
@end itemize

Loading...