On Tue, Jun 8, 2021 at 12:02 PM Christian Göttsche <cgzones@xxxxxxxxxxxxxx> wrote: > > ../cil/src/cil_write_ast.c:86:32: error: cast to smaller integer type 'enum cil_flavor' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast] > enum cil_flavor op_flavor = (enum cil_flavor)curr->data; > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > ../cil/src/cil_write_ast.c:130:37: error: cast to smaller integer type 'enum cil_flavor' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast] > enum cil_flavor operand_flavor = (enum cil_flavor)curr->data; > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Silence this warning by casting the pointer to an integer the cast to > enum cil_flavor. > > See 32f8ed3d6b0b ("libsepol/cil: introduce intermediate cast to silence -Wvoid-pointer-to-enum-cast") > > Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> Acked-by: James Carter <jwcart2@xxxxxxxxx> > --- > libsepol/cil/src/cil_write_ast.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libsepol/cil/src/cil_write_ast.c b/libsepol/cil/src/cil_write_ast.c > index 4871f704..186070c1 100644 > --- a/libsepol/cil/src/cil_write_ast.c > +++ b/libsepol/cil/src/cil_write_ast.c > @@ -83,7 +83,7 @@ static void write_expr(FILE *out, struct cil_list *expr) > break; > case CIL_OP: { > const char *op_str; > - enum cil_flavor op_flavor = (enum cil_flavor)curr->data; > + enum cil_flavor op_flavor = (enum cil_flavor)(uintptr_t)curr->data; > switch (op_flavor) { > case CIL_AND: > op_str = CIL_KEY_AND; > @@ -127,7 +127,7 @@ static void write_expr(FILE *out, struct cil_list *expr) > } > case CIL_CONS_OPERAND: { > const char *operand_str; > - enum cil_flavor operand_flavor = (enum cil_flavor)curr->data; > + enum cil_flavor operand_flavor = (enum cil_flavor)(uintptr_t)curr->data; > switch (operand_flavor) { > case CIL_CONS_U1: > operand_str = CIL_KEY_CONS_U1; > -- > 2.32.0 >