squid icon indicating copy to clipboard operation
squid copied to clipboard

Maintenance: Better xgetaddrinfo() local variable declarations

Open kinkie opened this issue 2 years ago • 3 comments

kinkie avatar Jul 03 '22 10:07 kinkie

updated; I've moved all declarations at the innermost useable scope and ensured proper initialization

kinkie avatar Jul 03 '22 14:07 kinkie

Okay, I'd like to change course on this one: this code hasn't been built in a long time, and I would like to just remove it.

If we look at getaddrinfo.h:69 , where xgetaddrinfo is declared, it contains in its parameters a sctruct addrinfo *; which is never declared in a visible scope for that declaration.

Forcing the precompiler guards to ensure that code is built, results in:


In file included from ../compat/compat.h:87,
                 from ../include/squid.h:32,
                 from GnuRegex.c:39:
../compat/getaddrinfo.h:71:45: error: 'struct addrinfo' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
                                const struct addrinfo *hints, struct addrinfo **res);
                                             ^~~~~~~~
../compat/getaddrinfo.h:75:41: error: 'struct addrinfo' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 SQUIDCEXTERN void xfreeaddrinfo (struct addrinfo *ai);
                                         ^~~~~~~~
cc1: all warnings being treated as errors

So my proposal is to just remove this compat file, it's probably a relic from a long time ago when a proper Internet stack was not present in all OSes.

kinkie avatar Jul 05 '22 04:07 kinkie

FWIW this code is/was for IPv6 support on native MinGW Windows builds. I do hope to get that environment building again so we can provide a modern Squid that does not require full Cygwin environment setup/install on Windows.

yadij avatar Jul 05 '22 10:07 yadij

@kinkie, you requested my review. But with the latest iteration of this I am waiting on confirmation that the mingw builds no longer need this compat code.

IIRC squidclient.exe used to build despite issues in the other code - so it should be usable as a test binary for the necessary proof-of-need.

yadij avatar Mar 03 '23 10:03 yadij

note to self: test build triggered at https://build.squid-cache.org/job/anybranch-mingw-cross/1/console

kinkie avatar Mar 19 '23 13:03 kinkie

Merging a very stale branch messed it up. Closing it, and opening a new one about removing:

getaddrinfo, getnameinfo.h, inet_ntop.h, inet_pton.h, getnameinfo.c, inet_ntop.c, inet_pton.c

kinkie avatar Jul 02 '23 20:07 kinkie

Closing it, and opening a new one

Before you open a new PR, please check that the outstanding change requests for this PR are addressed in the new PR branch.

BTW, you can always start from scratch in your workspace and then force-push your branch to the public PR branch. Force pushing should be avoided, but when the choice is between "closing one PR (with non-trivial review history) and opening a new one" and "force push", force pushing may be the lesser evil.

rousskov avatar Jul 02 '23 21:07 rousskov