Skip to content

Commit

Permalink
libsepol/cil: silence cast warning
Browse files Browse the repository at this point in the history
../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 32f8ed3 ("libsepol/cil: introduce intermediate cast to silence -Wvoid-pointer-to-enum-cast")

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
  • Loading branch information
cgzones authored and jwcart2 committed Jun 24, 2021
1 parent 1076a07 commit de3b96a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libsepol/cil/src/cil_write_ast.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit de3b96a

Please sign in to comment.