[Top][All Lists]

[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: Flávio Cruz
Subject: Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars.
Date: Tue, 19 Apr 2016 02:11:50 +0200


On 10 April 2016 at 22:30, Samuel Thibault <samuel.thibault@gnu.org> wrote:

Flavio Cruz, on Tue 05 Apr 2016 02:08:44 +0200, wrote:
> --- a/include/mach/message.h
> +++ b/include/mach/message.h
> @@ -188,8 +188,8 @@ typedef   struct {
>   *  a mach_msg_type_long_t should be zero.
>   */
> -typedef unsigned int mach_msg_type_name_t;
> -typedef unsigned int mach_msg_type_size_t;
> +typedef unsigned char mach_msg_type_name_t;
> +typedef unsigned short mach_msg_type_size_t;

Looking at this again, I'm realizing that this would change the ABI
of a big lot of functions, those which have a mach_msg_type_name_t *
parameter.  I don't think we can afford doing that :) Which warning do
you get, exactly?

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.

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,

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.


Flávio Cruz / flaviocruz@gmail.com

reply via email to

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