bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars.


From: Samuel Thibault
Subject: Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars.
Date: Sun, 24 Apr 2016 18:38:32 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Hello,

Flávio Cruz, on Tue 19 Apr 2016 02:11:50 +0200, wrote:
> I fully understand your worries about changing the ABI :) However, it could be
> nice to have a separate branch with ABI changes that could be incorporated 
> into
> a major release.

We can do that, yes.

> The warning I'm talking about is the following:
> 
> In file included from ipc/mach_port.server.c:10:0:
> ipc/mach_port.server.c: In function '_Xmach_port_extract_right':
> ../gnumach/include/mach/message.h:268:35: warning: large integer implicitly
> truncated to unsigned type [-Woverflow]
>  #define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
>                                    ^
> ipc/mach_port.server.c:1355:22: note: in expansion of macro
> 'MACH_MSG_TYPE_POLYMORPHIC'
>    /* msgt_name = */  MACH_MSG_TYPE_POLYMORPHIC,
>                       ^

Ok, I see.

> This shows when compiling some stubs since now mig generates code with
> MACH_MSG_TYPE_POLYMORPHIC instead of -1.
> I think this can be trivially fixed by removing the cast in
> MACH_MSG_TYPE_POLYMORPHIC.

But that will probably lead to other issues, because
MACH_MSG_TYPE_POLYMORPHIC would then be a signed value instead of an
unsigned value.

I'd say that we could add a cast here: MACH_MSG_TYPE_POLYMORPHIC is
meant to be of type mach_msg_type_name_t, and the code above squeezes it
into an 8-bit value. So the code could be casting it into (unsigned
char) this way:

fprintf(file, "\t\t/* msgt_name = */\t\t(unsigned char) %s,\n", 
it->itOutNameStr);

Samuel



reply via email to

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