52 lines
2.2 KiB
Diff
52 lines
2.2 KiB
Diff
|
From de3b96a158c60147703dc5d49c227a596d4ae165 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
||
|
Date: Tue, 8 Jun 2021 17:59:04 +0200
|
||
|
Subject: [PATCH] libsepol/cil: silence cast warning
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
../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@googlemail.com>
|
||
|
Acked-by: James Carter <jwcart2@gmail.com>
|
||
|
---
|
||
|
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 4871f7045e19..186070c1783a 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
|
||
|
|