2011/3/28 Kai Tietz <[email protected]>:
> 2011/3/28 Arnaud Charlet <[email protected]>:
>> Kai,
>>
>> Here are Thomas comments on your patch:
>>
>> --
>>> Split submitted patch from thread "[patch ada]: Fix issues about
>>> multilib build of native windows and handle MSG_WAITALL for windows
>>> native targets"
>>> into separate ones.
>>>
>>> ChangeLog gcc/ada (ada_wt.txt)
>>>
>>> 2011-03-28 Kai Tietz
>>>
>>> * g-socthi-mingw.adb (C_Recvmsg): Handle MSG_WAITALL for
>>> windows native targets.
>>> * s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows
>>> targets to flag value.
>>
>>> Fill : constant Boolean :=
>>> - (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
>>> + SOSC.MSG_WAITALL /= -1
>>> + and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
>>> -- Is the MSG_WAITALL flag set? If so we need to fully fill all
>>> vectors
>>
>> Not sure about this. The other change (to s-oscons-tmplt.c) causes
>> SOSC.MSG_WAITALL to always be defined to 8 in the Windows case, so the
>> new test against -1 (which would have been relevant without the other
>> change) now becomes redundant.
>
> Well, I can remove it from patch. But IMHO it would be good to fix
> here logic, even if it has obviously no effect here anymore. As often
> such code simply gets copy & pasted and then a latent bug can be
> copied.
>
>>> #ifndef MSG_WAITALL
>>> +#ifdef __MINWGW32__
>>> +/* We use it on windows native targets, so set to flag value. */
>>> +# define MSG_WAITALL (1 << 3)
>>> +#else
>>
>> The comment is completely meaningless and should be rewritten. In
>> particular a note should be added to explain why this will work even
>> though MSG_WAITALL is not defined in the Winsock header files.
>
> Yes, I wrote some more details about this definition. It is related
> to the use of winsock/winsock2. The define MSG_WAITALL is just defined
> for wsock API 2. Nevertheless we link internally against wsock2-API
> (ws2_32), and so it is available anyway.
>
> Updated patch attached.
>
> Regards,
> Kai
>
So here is the patch without the part in g-socthi-mingw.adb.
ChangeLog
2011-04-04 Kai Tietz
PR ada/4773
* s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows
targets to flag value.
Ok for apply?
Regards,
Kai
Index: gcc/gcc/ada/s-oscons-tmplt.c
===================================================================
--- gcc.orig/gcc/ada/s-oscons-tmplt.c 2011-03-28 11:40:51.949851800 +0200
+++ gcc/gcc/ada/s-oscons-tmplt.c 2011-03-28 13:13:51.479759900 +0200
@@ -1084,6 +1084,11 @@ CND(MSG_PEEK, "Peek at incoming data")
CND(MSG_EOR, "Send end of record")
#ifndef MSG_WAITALL
+#ifdef __MINWGW32__
+/* The value of MSG_WAITALL is 8. Nevertheless winsock.h doesn't
+ define it, but it is still usable as we link to winsock2 API. */
+# define MSG_WAITALL (1 << 3)
+#else
# define MSG_WAITALL -1
#endif
CND(MSG_WAITALL, "Wait for full reception")