On Sun, May 15, 2022 at 07:26:34PM -0400, Thomas Dickey wrote: > ----- Original Message ----- > | From: "alexandre schenberg" <ale.schenb...@yandex.com> > | To: xorg@lists.x.org > | Sent: Sunday, May 15, 2022 7:06:12 PM > | Subject: Malloc error when cross compiling libXt-1.2.1 > > | Hello. When I try to cross compile libXT 1.2.1 (or any version) for i386, I > | receive: > | > || configure:18569: checking whether malloc(0) returns NULL > > looks like > > https://gitlab.freedesktop.org/xorg/lib/libxt/-/blob/edd70bdfbbd16247e3d9564ca51d864f82626eb7/configure.ac > > XORG_CHECK_MALLOC_ZERO > > which comes from here: > > https://gitlab.freedesktop.org/xorg/util/macros/-/blob/master/xorg-macros.m4.in > https://gitlab.freedesktop.org/xorg/util/macros/-/blob/master/xorg-macros.m4.in#L1370 > > and as explained here > > https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Runtime.html > > it's lacking a third choice on the end of the AC_RUN_IFELSE macro. > Overlooked here: > > https://gitlab.freedesktop.org/xorg/util/macros/-/commit/af0164c2ded2dcc95b72ca3b9bfbad9b790490f7
It's used in Alloc.c in Xt: https://gitlab.freedesktop.org/xorg/lib/libxt/-/blob/edd70bdfbbd16247e3d9564ca51d864f82626eb7/src/Alloc.c#L167 which notwithstanding the comment, the C standard doesn't offer much help: https://stackoverflow.com/questions/2132273/what-does-malloc0-return ...so the safest thing to do with the macro would be to supply a warning and define MALLOC_0_RETURNS_NULL -- Thomas E. Dickey <dic...@invisible-island.net> https://invisible-island.net ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature