Generally I would rather see proper checking of return codes rather then simply ignore them. For some of them, assert may be good enough check. Comments inside:
Russell Bryant napsal(a): > Resolve compiler warnings emitted by gcc 4.6.0. Specifically, the > warnings addressed here are for when a variable was being set but never > used. The related variables have been removed. This makes the code > back to building successfully with -Werror (at least for me). > > Signed-off-by: Russell Bryant <russ...@russellbryant.net> > --- > exec/coroipcs.c | 17 +++++++---------- > exec/crypto.c | 2 -- > exec/totemudpu.c | 3 --- > test/testsam.c | 8 ++++---- > 4 files changed, 11 insertions(+), 19 deletions(-) > > diff --git a/exec/coroipcs.c b/exec/coroipcs.c > index a58c269..5fa89ca 100644 > --- a/exec/coroipcs.c > +++ b/exec/coroipcs.c > @@ -618,9 +618,8 @@ static inline void zerocopy_operations_process ( > coroipc_response_header_t res_header; > void *addr = NULL; > struct coroipcs_zc_header *zc_header; > - unsigned int res; > > - res = zcb_alloc (conn_info, hdr->path_to_file, hdr->map_size, > + zcb_alloc (conn_info, hdr->path_to_file, hdr->map_size, > &addr); > Check > zc_header = (struct coroipcs_zc_header *)addr; > @@ -664,7 +663,6 @@ static inline void zerocopy_operations_process ( > static void *pthread_ipc_consumer (void *conn) > { > struct conn_info *conn_info = (struct conn_info *)conn; > - int res; > coroipc_request_header_t *header; > coroipc_response_header_t coroipc_response_header; > int send_ok; > @@ -673,7 +671,7 @@ static void *pthread_ipc_consumer (void *conn) > > #if defined(HAVE_PTHREAD_SETSCHEDPARAM) && > defined(HAVE_SCHED_GET_PRIORITY_MAX) > if (api->sched_policy != 0) { > - res = pthread_setschedparam (conn_info->thread, > + pthread_setschedparam (conn_info->thread, > api->sched_policy, api->sched_param); > } Check > #endif > @@ -690,7 +688,7 @@ static void *pthread_ipc_consumer (void *conn) > ipc_sem_getvalue (conn_info->control_buffer, SEMAPHORE_REQUEST, > &sem_value); > if (sem_value > 0) { > > - res = ipc_sem_wait (conn_info->control_buffer, > SEMAPHORE_REQUEST, IPC_SEMWAIT_NOFILE); > + ipc_sem_wait (conn_info->control_buffer, > SEMAPHORE_REQUEST, IPC_SEMWAIT_NOFILE); Check > } else { > continue; > } > @@ -1094,7 +1092,6 @@ void coroipcs_ipc_exit (void) > { > struct list_head *list; > struct conn_info *conn_info; > - unsigned int res; > > for (list = conn_info_list_head.next; list != &conn_info_list_head; > list = list->next) { > @@ -1118,13 +1115,13 @@ void coroipcs_ipc_exit (void) > /* > * Unmap memory segments > */ > - res = munmap ((void *)conn_info->control_buffer, > + munmap ((void *)conn_info->control_buffer, > conn_info->control_size); > - res = munmap ((void *)conn_info->request_buffer, > + munmap ((void *)conn_info->request_buffer, > conn_info->request_size); > - res = munmap ((void *)conn_info->response_buffer, > + munmap ((void *)conn_info->response_buffer, > conn_info->response_size); > - res = circular_memory_unmap (conn_info->dispatch_buffer, > + circular_memory_unmap (conn_info->dispatch_buffer, > conn_info->dispatch_size); > } > } Check > diff --git a/exec/crypto.c b/exec/crypto.c > index e21aa16..4f4cac7 100644 > --- a/exec/crypto.c > +++ b/exec/crypto.c > @@ -1140,12 +1140,10 @@ int sha1_done(hash_state * md, unsigned char *hash) > int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned > long keylen) > { > unsigned char buf[128]; > - unsigned long hashsize; > unsigned long i; > int err; > > hmac->hash = hash; > - hashsize = hash_descriptor[hash]->hashsize; > > /* valid key length? */ > assert (keylen > 0); > diff --git a/exec/totemudpu.c b/exec/totemudpu.c > index c18e59f..42b5a9e 100644 > --- a/exec/totemudpu.c > +++ b/exec/totemudpu.c > @@ -1703,8 +1703,5 @@ int totemudpu_member_remove ( > void *udpu_context, > const struct totem_ip_address *token_target) > { > - struct totemudpu_instance *instance = (struct totemudpu_instance > *)udpu_context; > - > - instance = NULL; > return (0); > } This one IS interesting, because previous implementation was NO OP. In other words, it should be nice to: - totally remove that function - remove it's instance from totemnet.c > diff --git a/test/testsam.c b/test/testsam.c > index d29605a..bdcf118 100644 > --- a/test/testsam.c > +++ b/test/testsam.c > @@ -244,7 +244,7 @@ static int test2 (void) { > static int test3 (void) { > cs_error_t error; > unsigned int instance_id; > - int tmp1, tmp2, tmp3; > + int tmp1, tmp2; > > printf ("%s: initialize\n", __FUNCTION__); > error = sam_initialize (0, SAM_RECOVERY_POLICY_RESTART); > @@ -268,9 +268,9 @@ static int test3 (void) { > } > > printf ("%s iid %d: divide by zero\n", __FUNCTION__, > instance_id); > - tmp2 = rand (); > - tmp3 = 0; > - tmp1 = tmp2 / tmp3; > + tmp1 = rand (); > + tmp2 = 0; > + tmp1 = tmp1 / tmp2; > > return 1; > } Regards, Honza _______________________________________________ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais