[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: |
Mon, 4 Apr 2016 09:16:17 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Hello,
Flavio Cruz, on Sun 03 Apr 2016 16:12:48 +0200, wrote:
> mach_msg_type_name_t and mach_msg_type_size_t are used as 8 bit fields in
> mach_msg_type_t struct, therefore they should be treated as unsigned char's to
> avoid warnings when using macros such as MACH_MSG_TYPE_POLYMORPIC.
Mmm, looking quickly at the mach code shows that there is a "long"
variant of these fields, see for instance ipc_kmsg_clean_body() which
uses a mach_msg_type_long_t
Could you provide an example of warning that this fixes? Perhaps we
actually need to fix the code that triggers warnings.
> * include/mach/message.h: Update typedef.
> * include/mach/std_types.defs: Change to char.
> ---
> include/mach/message.h | 4 ++--
> include/mach/std_types.defs | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/mach/message.h b/include/mach/message.h
> index 0a7297e..57b81c3 100644
> --- 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 char mach_msg_type_size_t;
> typedef natural_t mach_msg_type_number_t;
>
> typedef struct {
> diff --git a/include/mach/std_types.defs b/include/mach/std_types.defs
> index a1f156d..d70e970 100644
> --- a/include/mach/std_types.defs
> +++ b/include/mach/std_types.defs
> @@ -75,7 +75,7 @@ type mach_port_mscount_t = unsigned;
> type mach_port_msgcount_t = unsigned;
> type mach_port_rights_t = unsigned;
> type mach_msg_id_t = integer_t;
> -type mach_msg_type_name_t = unsigned;
> +type mach_msg_type_name_t = char;
> type mach_msg_type_number_t = natural_t;
>
> type mach_port_move_receive_t = MACH_MSG_TYPE_MOVE_RECEIVE
> --
> 2.7.0
>
>
--
Samuel
Yep. Moi j'ai un clavier à une touche.
Par contre, ma souris a 102 boutons, c'est pas toujours pratique.
-+- OG in: Guide du Cabaliste Usenet - Le mulot contre attaque -+-
- [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars., Flavio Cruz, 2016/04/03
- Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars.,
Samuel Thibault <=
- Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars., Justus Winter, 2016/04/04
- Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars., Flavio Cruz, 2016/04/04
- Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars., Samuel Thibault, 2016/04/10
- Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars., Flávio Cruz, 2016/04/18
- Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars., Samuel Thibault, 2016/04/24