Re: socklen_t data type
Keith Marshall <[email protected]> Tue, 30 Jun 2020 07:54:18 +0100
| Newsgroups | gmane.comp.gnu.mingw.user |
|---|---|
| Organization | MinGW.org Project |
| Message-ID | <[email protected]> |
On 30/06/2020 03:32, Eli Zaretskii wrote: >> From: Keith Marshall <[email protected]> >> Date: Mon, 29 Jun 2020 22:34:58 +0100 >> >>> This causes trouble when compiling a recent GDB: both Gnulib and >>> GDB's own sources assume that socklen_t is a signed int. Moreover, >>> winsock functions like 'accept' and 'getsockname', expect an 'int *' >>> type of their last argument, and it is customary to pass a >>> 'socklen_t *' value there. >> >> Ouch! I'm guessing that the difference in "signedness" raises warnings, >> at best, and possibly even incompatible type conflict errors? > > 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? >> so if it makes life easier, feel free to modify your local copy, and >> I'll revert that change for future releases. > > Done; thanks. 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 ))) ) BTW, it was compiling my <wspiapi,h> test program with C++, to verify this, which led me to conclude that your understanding of -fpermissive may be inverted. -- Regards, Keith. Public key available from keys.gnupg.net Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F _______________________________________________ MinGW-Users mailing list [email protected] This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists. We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated. _______________________________________________ You may change your MinGW Account Options or unsubscribe at: https://lists.osdn.me/mailman/listinfo/mingw-users Also: mailto:[email protected]?subject=unsubscribe
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEwZ7AGBVH3lDh1I9TwK02xjR+Wj8FAl764ZsACgkQwK02xjR+ Wj+lbRAAvcuSb2LRrUmhoiEiWguftyNZvqixtNosOiBhYZ+G81UftvUz11Z/I0wY JKyaRUVcIx3Tshf3hYLq82IX1BiRjVyUno9sZJc5/Ow/XE1fPFuUjamHpb+iL0G3 yDQx42TN4bHQjDqPpS73bDPfFMATkHjJW7sKI5roaUE8v6m3xeVZevgW8YlayBHm GWTm8c84s0F3nOQZYXBk0G0OiOx/62V2voeFq/wbd619lHn+mHX65gM62UUNZuvf A0idTmlAw0NFDzydwBGqGeAM3QLiJRKOj9Wgofzvt3vSm5GyDNPHBNnO5gci3bvD iyR5rLcSB/77n9R8m5ijowP/Aja84+s6Z2IRT3UG4+4JkbvNwNI/+XsY+jd7+/V0 3Rgqt/fitYvgGQmfxHLPOdPXv1sEaBsh1VbucI21d66FS3/bG+w5r7dd4UrZbYNI tiROPRPGk3MNfK/nGIcsrmet9fblSlOsJCIL2+o9xXQfewO7MYWCv3TiEY/Y7vwW TyknA+YwJgHCMJpFeR26k6v4HpVV6Ehm0zK2g2H1e9yT0XhMot7iDJXubRFRdKhr niP8VzzK3TrNsPuRLHktScGAeCt8Jcx/Fe8cUHpUwOMtwWh9ZcpoYbKp+X7mIrh7 9pbKOwnCm4ZZhBLAhi9fQVbJepWiq6oEoXe9reLwG+Su4m8eZAw= =5+Z+ -----END PGP SIGNATURE-----