Re: [AD] Type-pun warnings with GCC 4.1 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2006-07-02, Chris <chris.kcat@xxxxxxxxxx> wrote:
> When building the latest SVN from SF using GCC 4.1.1, I get some type-pun
> warnings when compiling dat.c and grabber.c (which would invariably cause
> failure with --enable-strictwarn). The attached patch fixes dat.c,
You can commit those if they work.
> but
> grabber.c may prove to be a little trickier. For reference, the lines are
> 516, 1743, and 3271. The first of which is below:
>
> static void get_selection_info(DATAFILE **dat, DATAFILE ***parent)
> {
> if ((SELECTED_ITEM <= 0) || (SELECTED_ITEM >= data_count)) {
> *dat = NULL;
> *parent = &datafile;
> }
> else {
> *dat = data[SELECTED_ITEM].dat;
> if ((*dat)->type == DAT_FILE)
> *parent = (DATAFILE **)&(*dat)->dat; // error here!
> else
> *parent = data[SELECTED_ITEM].parent;
> }
> }
If a better way is not found, it appears squeezing in an intermediate
cast to (void *) disables the warnings, e.g.
*parent = (DATAFILE **) (void *) &(*dat)->dat; // error here!
Peter