From 4a5f3de56d1af84bdea3cfc786b6cd2cbe00f7ef Mon Sep 17 00:00:00 2001 Message-Id: <4a5f3de56d1af84bdea3cfc786b6cd2cbe00f7ef.1677135462.git.Brian.Inglis@Shaw.ca> From: Brian Inglis Date: Wed, 22 Feb 2023 23:56:48 -0700 Subject: [PATCH] src/libs/libxutil/XFontName.c(utoa): non-GNU stdlib.h conflict To: bug-groff@gnu.org Bcc: Brian.Inglis@SystematicSW.ab.ca gcc 11.3 build failure when static utoa definition in XFontName.c conflicts with extern utoa declared in stdlib.h third argument is usually int conversion radix instead of groff int buffer size in non-GNU libc including newlib, QNX, IBM, others .../src/libs/libxutil/XFontName.c: At top level: .../src/libs/libxutil/XFontName.c:122:1: error: static declaration of ‘utoa’ follows non-static declaration 122 | utoa (unsigned int u, char *s, int size) | ^~~~ In file included from ./lib/stdlib.h:28, from ./lib/unistd.h:93, from /usr/include/X11/Xos.h:89, from .../src/libs/libxutil/XFontName.c:27: /usr/include/stdlib.h:228:9: note: previous declaration of ‘utoa’ with type ‘char *(unsigned int, char *, int)’ 228 | char * utoa (unsigned, char *, int); | ^~~~ make[1]: *** [Makefile:8017: src/libs/libxutil/libxutil_a-XFontName.o] Error 1 utoa renamed to utoan as groff definition is static with 3rd argument int buffer size instead of conversion radix [other functions commonly defined are itoa, ultoa, ftoa, dtoa] --- src/libs/libxutil/XFontName.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/libxutil/XFontName.c b/src/libs/libxutil/XFontName.c index 81ccdaab2b1f..92ce13893a38 100644 --- a/src/libs/libxutil/XFontName.c +++ b/src/libs/libxutil/XFontName.c @@ -119,7 +119,7 @@ XParseFontName (XFontNameString fontNameString, XFontName *fontName, } static char * -utoa (unsigned int u, char *s, int size) +utoan (unsigned int u, char *s, int size) { char *t; @@ -156,7 +156,7 @@ XFormatFontName (XFontName *fontName, unsigned int fontNameAttributes, #define PutUnsigned(field, bit) \ f = (fontNameAttributes & bit) ? \ - utoa (fontName->field, number, sizeof (number)) \ + utoan (fontName->field, number, sizeof (number)) \ : (char *)"*"; \ if ((left -= strlen (f)) < 0) \ return False; \ -- 2.39.0