Blame SOURCES/0074-libsepol-cil-silence-cast-warning.patch

71cd55
From de3b96a158c60147703dc5d49c227a596d4ae165 Mon Sep 17 00:00:00 2001
71cd55
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
71cd55
Date: Tue, 8 Jun 2021 17:59:04 +0200
71cd55
Subject: [PATCH] libsepol/cil: silence cast warning
71cd55
MIME-Version: 1.0
71cd55
Content-Type: text/plain; charset=UTF-8
71cd55
Content-Transfer-Encoding: 8bit
71cd55
71cd55
../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]
71cd55
                        enum cil_flavor op_flavor = (enum cil_flavor)curr->data;
71cd55
                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
71cd55
../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]
71cd55
                        enum cil_flavor operand_flavor = (enum cil_flavor)curr->data;
71cd55
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
71cd55
71cd55
Silence this warning by casting the pointer to an integer the cast to
71cd55
enum cil_flavor.
71cd55
71cd55
See 32f8ed3d6b0b ("libsepol/cil: introduce intermediate cast to silence -Wvoid-pointer-to-enum-cast")
71cd55
71cd55
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
71cd55
Acked-by: James Carter <jwcart2@gmail.com>
71cd55
---
71cd55
 libsepol/cil/src/cil_write_ast.c | 4 ++--
71cd55
 1 file changed, 2 insertions(+), 2 deletions(-)
71cd55
71cd55
diff --git a/libsepol/cil/src/cil_write_ast.c b/libsepol/cil/src/cil_write_ast.c
71cd55
index 4871f7045e19..186070c1783a 100644
71cd55
--- a/libsepol/cil/src/cil_write_ast.c
71cd55
+++ b/libsepol/cil/src/cil_write_ast.c
71cd55
@@ -83,7 +83,7 @@ static void write_expr(FILE *out, struct cil_list *expr)
71cd55
 			break;
71cd55
 		case CIL_OP: {
71cd55
 			const char *op_str;
71cd55
-			enum cil_flavor op_flavor = (enum cil_flavor)curr->data;
71cd55
+			enum cil_flavor op_flavor = (enum cil_flavor)(uintptr_t)curr->data;
71cd55
 			switch (op_flavor) {
71cd55
 			case CIL_AND:
71cd55
 				op_str = CIL_KEY_AND;
71cd55
@@ -127,7 +127,7 @@ static void write_expr(FILE *out, struct cil_list *expr)
71cd55
 		}
71cd55
 		case CIL_CONS_OPERAND: {
71cd55
 			const char *operand_str;
71cd55
-			enum cil_flavor operand_flavor = (enum cil_flavor)curr->data;
71cd55
+			enum cil_flavor operand_flavor = (enum cil_flavor)(uintptr_t)curr->data;
71cd55
 			switch (operand_flavor) {
71cd55
 			case CIL_CONS_U1:
71cd55
 				operand_str = CIL_KEY_CONS_U1;
71cd55
-- 
71cd55
2.32.0
71cd55