From: Arnaud Giersch Date: Mon, 4 Jun 2012 14:15:16 +0000 (+0200) Subject: Declare as "unsigned" bit fields used as boolean. X-Git-Tag: v3_8~646^2~23 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c889898bf14884ce0a970e411e35337e330a042c Declare as "unsigned" bit fields used as boolean. Signed bit fields of length 1 do not make much sense. This is a followup for commit 1377c28e7b9f315616ee6fddc6baa755e0380e75. --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 0bdfbab887..f1d989fd73 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -164,7 +164,7 @@ typedef struct s_smx_context { void *data; /* Here SIMIX stores the smx_process_t containing the context */ char **argv; int argc; - int iwannadie:1; + unsigned iwannadie:1; } s_smx_ctx_base_t; /* methods of this class */ diff --git a/src/gras/Virtu/virtu_sg.h b/src/gras/Virtu/virtu_sg.h index f4e7bab1fd..7554d19b08 100644 --- a/src/gras/Virtu/virtu_sg.h +++ b/src/gras/Virtu/virtu_sg.h @@ -16,7 +16,7 @@ typedef struct { int port; /* list of ports used by a server socket */ - int meas:1; /* (boolean) the channel is for measurements or for messages */ + unsigned meas:1; /* (boolean) the channel is for measurements or for messages */ smx_process_t server; smx_rdv_t rdv; } s_gras_sg_portrec_t, *gras_sg_portrec_t; diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index a50b31f9e6..4d25f014d5 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -140,7 +140,7 @@ typedef struct s_smx_action { void *dst_buff; size_t src_buff_size; size_t *dst_buff_size; - unsigned int copied:1; /* whether the data were already copied */ + unsigned copied:1; /* whether the data were already copied */ void* src_data; /* User data associated to communication */ void* dst_data; diff --git a/src/simix/smx_process_private.h b/src/simix/smx_process_private.h index 2b9359be0a..5365da12fe 100644 --- a/src/simix/smx_process_private.h +++ b/src/simix/smx_process_private.h @@ -22,9 +22,9 @@ typedef struct s_smx_process { smx_host_t smx_host; /* the host on which the process is running */ smx_context_t context; /* the context (either uctx or thread) that executes the user function */ xbt_running_ctx_t *running_ctx; - int doexception:1; - int blocked:1; - int suspended:1; + unsigned doexception:1; + unsigned blocked:1; + unsigned suspended:1; smx_host_t new_host; /* if not null, the host on which the process must migrate to */ smx_action_t waiting_action; /* the current blocking action if any */ xbt_fifo_t comms; /* the current non-blocking communication actions */ diff --git a/src/xbt/config.c b/src/xbt/config.c index 8bc054aac9..87418cde9c 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -33,7 +33,7 @@ typedef struct { /* Allowed type of the variable */ e_xbt_cfgelm_type_t type; int min, max; - int isdefault:1; + unsigned isdefault:1; /* Callbacks */ xbt_cfg_cb_t cb_set; diff --git a/src/xbt/datadesc/datadesc_private.h b/src/xbt/datadesc/datadesc_private.h index 0c1c802ec1..1faf92e48d 100644 --- a/src/xbt/datadesc/datadesc_private.h +++ b/src/xbt/datadesc/datadesc_private.h @@ -216,7 +216,7 @@ typedef struct s_xbt_datadesc_type { xbt_datadesc_type_cb_void_t recv; /* flags */ - int cycle:1; + unsigned cycle:1; /* random value for users (like default value or whatever) */ char extra[SIZEOF_MAX]; diff --git a/src/xbt/datadesc/ddt_parse.c b/src/xbt/datadesc/ddt_parse.c index a3f46942cd..166b5b7cd3 100644 --- a/src/xbt/datadesc/ddt_parse.c +++ b/src/xbt/datadesc/ddt_parse.c @@ -17,14 +17,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_parse, xbt_ddt, typedef struct s_type_modifier { short is_long; - int is_unsigned:1; - int is_short:1; + unsigned is_unsigned:1; + unsigned is_short:1; - int is_struct:1; - int is_union:1; - int is_enum:1; + unsigned is_struct:1; + unsigned is_union:1; + unsigned is_enum:1; - int is_ref:1; + unsigned is_ref:1; int is_dynar:2; int is_matrix:2; diff --git a/src/xbt/xbt_sg_synchro.c b/src/xbt/xbt_sg_synchro.c index d485ba37ed..e9bbaeba23 100644 --- a/src/xbt/xbt_sg_synchro.c +++ b/src/xbt/xbt_sg_synchro.c @@ -28,7 +28,7 @@ typedef struct s_xbt_thread_ { void *userparam; void *father_data; /* stuff to allow other people to wait on me with xbt_thread_join */ - int joinable:1, done:1; + unsigned joinable:1, done:1; xbt_cond_t cond; xbt_mutex_t mutex; } s_xbt_thread_t; diff --git a/src/xbt/xbt_socket_private.h b/src/xbt/xbt_socket_private.h index bf74ce8792..5816b17586 100644 --- a/src/xbt/xbt_socket_private.h +++ b/src/xbt/xbt_socket_private.h @@ -28,12 +28,12 @@ typedef struct s_xbt_socket { xbt_trp_plugin_t plugin; - int incoming:1; /* true if we can read from this sock */ - int outgoing:1; /* true if we can write on this sock */ - int accepting:1; /* true if master incoming sock in tcp */ - int meas:1; /* true if this is an experiment socket instead of messaging */ - int valid:1; /* false if a select returned that the peer has left, forcing us to "close" the socket */ - int moredata:1; /* TCP socket use a buffer and read operation get as much + unsigned incoming:1; /* true if we can read from this sock */ + unsigned outgoing:1; /* true if we can write on this sock */ + unsigned accepting:1; /* true if master incoming sock in tcp */ + unsigned meas:1; /* true if this is an experiment socket instead of messaging */ + unsigned valid:1; /* false if a select returned that the peer has left, forcing us to "close" the socket */ + unsigned moredata:1; /* TCP socket use a buffer and read operation get as much data as possible. It is possible that several messages are received in one shoot, and select won't catch them afterward again. @@ -42,7 +42,7 @@ typedef struct s_xbt_socket { sockets are not concerned since they use the TCP interface directly, with no buffer. */ - int recvd:1; /* true if the recvd_val field contains one byte of the stream (that we peek'ed to check the socket validity) */ + unsigned recvd:1; /* true if the recvd_val field contains one byte of the stream (that we peek'ed to check the socket validity) */ char recvd_val; /* what we peeked from the socket, if any */ int refcount; /* refcounting on shared sockets */ diff --git a/tools/tesh/run_context.h b/tools/tesh/run_context.h index 7721e3ee21..d888d84741 100644 --- a/tools/tesh/run_context.h +++ b/tools/tesh/run_context.h @@ -23,18 +23,18 @@ typedef struct { int env_size; char *filepos; int pid; - int is_background:1; - int is_empty:1; - int is_stoppable:1; + unsigned is_background:1; + unsigned is_empty:1; + unsigned is_stoppable:1; - int brokenpipe:1; - int timeout:1; + unsigned brokenpipe:1; + unsigned timeout:1; - int reader_done:1; /* reader set this to true when he's done because + unsigned reader_done:1; /* reader set this to true when he's done because the child is dead. The main thread use it to detect that the child is not dead before the end of timeout */ - int interrupted:1; /* Whether we got stopped by an armageddon */ + unsigned interrupted:1; /* Whether we got stopped by an armageddon */ xbt_os_mutex_t interruption; /* To allow main thread to kill a runner one only at certain points */ @@ -46,7 +46,7 @@ typedef struct { int end_time; /* begin_time + timeout, as epoch */ char *expected_signal; /* name of signal to raise (or NULL if none) */ int expected_return; /* the exepeted return code of following command */ - int output_sort:1; /* whether the output must be sorted before comparison */ + unsigned output_sort:1; /* whether the output must be sorted before comparison */ /* buffers */ xbt_strbuff_t input;