bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] src/libs/libxutil/XFontName.c(utoa): non-GNU stdlib.h conflict


From: Brian Inglis
Subject: [PATCH] src/libs/libxutil/XFontName.c(utoa): non-GNU stdlib.h conflict
Date: Thu, 23 Feb 2023 00:46:45 -0700

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]