[Top][All Lists]

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

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

From: G. Branden Robinson
Subject: Re: [PATCH] src/libs/libxutil/XFontName.c(utoa): non-GNU stdlib.h conflict
Date: Thu, 23 Feb 2023 10:07:04 -0600

[looping in groff@gnu for discussion]

Hi Brian,

At 2023-02-23T00:46:45-0700, Brian Inglis wrote:
> gcc 11.3 build failure when static utoa definition in XFontName.c
> conflicts with extern utoa declared in stdlib.h

(but is not a WG14- or POSIX-standardized function)

> third argument is usually int conversion radix instead of groff int
> buffer size in non-GNU libc including newlib, QNX, IBM, others

Can you say specifically which system you built on?

Bertrand and I have tentatively agreed to make the next tag the final
one for 1.23.0.  (He might change his mind after seeing my next push,
but I sent him a diff of Savannah master and my working copy yesterday.)

I've been trying to avoid making changes to compiled code as the release
candidates have progressed.

I therefore think this issue is out of reach for groff 1.23.0 final.
I'll add a release note or caveat to the announcement advising people on
such platforms to build without X11 support (./configure --without-x).
I get the feeling not a lot of people use gxditview or xtotroff anyway.

I'm also a bit curious.  This issue seems like it should have arisen
decades ago.

> .../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

We can return to this issue after groff 1.23.0 final, but I think I'd
rather rename the functions with a prefix.  "xutil_" or something.

C's refusal to embrace name spaces has always been a problem.

[ Obligatory partisanship: Ada 83 had them.  ;-) ]

> [other functions commonly defined are itoa, ultoa, ftoa, dtoa]

Yes, probably best to make this change systematically since we don't
know what some crazy libc is going to define.

Could you file a Savannah ticket about this so it doesn't get forgotten



Attachment: signature.asc
Description: PGP signature

reply via email to

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