On 30/06/2020 15:23, Eli Zaretskii wrote: >> From: Keith Marshall, Tue, 30 Jun 2020 07:54:18 +0100 >> >>> GDB is a C++ program these days, and is compiled with -fpermissive, so >>> this causes errors. >> >> Surely -fpermissive relaxes the error checking for type conflicts, >> (possibly among other conditions -- I don't know what its scope is), so >> such errors would be downgraded to warnings. Do you, perhaps, mean that >> GDB is compiled _without_ -fpermissive? > > You are probably right. All I know is that g++ emitted this: > > CXX remote-utils.o > remote-utils.cc: In function 'void handle_accept_event(int, gdb_client_data)': > remote-utils.cc:146:69: error: invalid conversion from 'socklen_t*' {aka 'unsigned int*'} to 'int*' [-fpermissive] > 146 | remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &len); > | ^~~~ > | | > | socklen_t* {aka unsigned int*} > > I guess I mis-interpreted what that confusing message means to say. Indeed, it does appear that the error arises because -fpermissive is enabled, but when I compiled my own test program _without_ -fpermissive, I got a similar message; when I compiled _with_ -fpermissive, I got the same message, but downgraded from error to warning. >> There's more to it. As I reported in: >> >> https://savannah.gnu.org/bugs/?57725 >> >> a primary motivator for the change to unsigned socklen_t was to avoid a >> proliferation of casts in <wspiapi.h>, (of which, at the time, I seemed >> to be writing quite a number). Reviewing it again, I seem to have ended >> up with only one such cast which remains necessary, at line 917: >> >> if( (sa == NULL) || (len < sizeof( struct sockaddr )) ) >> >> With reversion to signed socklen_t, this should become: >> >> if( (sa == NULL) || (len < (socklen_t)(sizeof( struct sockaddr ))) ) > > You are a better judge of this, but to my mind a single cast is a > small price to pay for avoiding the kind of mess I faced yesterday, > with socklen_t popping up in compilation errors left and right. > > Gnulib already removed the unnecessary conflicting typedef, and I will > shortly report the problem in the GDB sources to its developers. But > I think the problems with code which assumes the last argument of > 'accept' and its ilk could be a 'socklen_t *' are a much harder nut, > and so going back to a signed int will be a good compromise. I've made that change, (both change of typedef, and the corresponding cast), in wsl-5.3.4, which I've uploaded to FRS this morning. -- Regards, Keith. Public key available from keys.gnupg.net Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20200706/7952d22b/attachment.sig>