diff options
author | Mark M. Hoffman <mhoffman@lightlink.com> | 2004-03-08 04:39:50 +0000 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2004-03-08 04:39:50 +0000 |
commit | 71a96916d599295d0be1189e460b9bab1e561861 (patch) | |
tree | d002e797372d82344a3e7b17a1e8e59b137eed84 /lib/conf-parse.y | |
parent | e1c3e50aaceb86467b22ed85291f8c0844275639 (diff) | |
download | lm-sensors-git-71a96916d599295d0be1189e460b9bab1e561861.tar.gz |
Patch by Philipp Thomas <pth@suse.de>:
> Current gcc versions warn when type punning is used, as this breaks the
> strict aliasing analysis gcc 3.3 does by default. When checking the causes
> for these warnings I discovered that sensors_malloc_array,
> sensors_free_array, sensors_add_array_el and sensors_add_array_els in
> lib/general.c all take a 'void **' for the list. This is plain wrong as
> the C standard only allow 'char *' and 'void *' to alias any other type, so
> if these functions should take a generic pointer, it *must* be a 'void *'
> that's internally cast to a 'void **'.
>
> The attached patch does this and adapts all places where these functions are
> called. Note that when done correctly, no cast what-so-ever in the calling
> code is needed.
>
> The patch is against current lm_sensors2 cvs version.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2345 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'lib/conf-parse.y')
-rw-r--r-- | lib/conf-parse.y | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/conf-parse.y b/lib/conf-parse.y index 0e35e6d1..ee22e7af 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -41,38 +41,38 @@ static sensors_expr *malloc_expr(void); static sensors_chip *current_chip = NULL; #define bus_add_el(el) sensors_add_array_el(el,\ - (void **) &sensors_config_busses,\ + &sensors_config_busses,\ &sensors_config_busses_count,\ &sensors_config_busses_max,\ sizeof(sensors_bus)) #define label_add_el(el) sensors_add_array_el(el,\ - (void **) ¤t_chip->labels,\ + ¤t_chip->labels,\ ¤t_chip->labels_count,\ ¤t_chip->labels_max,\ sizeof(sensors_label)); #define set_add_el(el) sensors_add_array_el(el,\ - (void **) ¤t_chip->sets,\ + ¤t_chip->sets,\ ¤t_chip->sets_count,\ ¤t_chip->sets_max,\ sizeof(sensors_set)); #define compute_add_el(el) sensors_add_array_el(el,\ - (void **) ¤t_chip->computes,\ + ¤t_chip->computes,\ ¤t_chip->computes_count,\ ¤t_chip->computes_max,\ sizeof(sensors_compute)); #define ignore_add_el(el) sensors_add_array_el(el,\ - (void **) ¤t_chip->ignores,\ + ¤t_chip->ignores,\ ¤t_chip->ignores_count,\ ¤t_chip->ignores_max,\ sizeof(sensors_ignore)); #define chip_add_el(el) sensors_add_array_el(el,\ - (void **) &sensors_config_chips,\ + &sensors_config_chips,\ &sensors_config_chips_count,\ &sensors_config_chips_max,\ sizeof(sensors_chip)); #define fits_add_el(el,list) sensors_add_array_el(el,\ - (void **) &(list).fits,\ + &(list).fits,\ &(list).fits_count,\ &(list).fits_max, \ sizeof(sensors_chip_name)); |