bug-groff
[Top][All Lists]
Advanced

[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: Brian Inglis
Subject: Re: [PATCH] src/libs/libxutil/XFontName.c(utoa): non-GNU stdlib.h conflict
Date: Thu, 23 Feb 2023 10:04:41 -0700
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

Thanks Branden,

On 2023-02-23 09:07, G. Branden Robinson wrote:
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?

newlib under Cygwin - catches glibc and linux assumptions

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.

Recent gcc dropping legacy language feature support and adding stricter diagnosis as errors where possible, where previously only gave warnings?

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

Did not find any related functions in current code base.

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

https://savannah.gnu.org/bugs/?group=groff&func=additem

Done    https://savannah.gnu.org/bugs/index.php?63831

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                -- Antoine de Saint-Exupéry



reply via email to

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