[makedumpfile PATCH 1/2] Fix compilation warnings on ppc64/ppc64le platforms

Bhupesh Sharma bhsharma at redhat.com
Thu Nov 16 13:29:59 PST 2017


I ran into the following compilation warnings while compiling
makedumpfile on ppc64/ppc64le platforms:

-D_LARGEFILE64_SOURCE -DVERSION='"1.6.2"' -DRELEASE_DATE='"27 Jul 2017"'
-D__powerpc64le__  -DUSELZO -DUSESNAPPY  print_info.o dwarf_info.o
elf_info.o erase_info.o sadump_info.o cache.o arch/arm.o arch/arm64.o
arch/x86.o arch/x86_64.o arch/ia64.o arch/ppc64.o arch/s390x.o
arch/ppc.o arch/sparc64.o -rdynamic -o makedumpfile makedumpfile.c
-lpthread -lsnappy -llzo2 -ldw -lbz2 -lebl -ldl -lelf -lz

makedumpfile.c: In function ‘initial_xen’:
makedumpfile.c:9442:16: warning: unused variable ‘size’ [-Wunused-variable]
  unsigned long size;
                  ^
makedumpfile.c:9441:8: warning: unused variable ‘offset’ [-Wunused-variable]
  off_t offset;
            ^
makedumpfile.c:9440:6: warning: unused variable ‘xen_info_required’ [-Wunused-variable]
  int xen_info_required = TRUE;
            ^

This is caused because while we don't support Xen on powerpc,
we still have the above variables declared outside the
'#if defined(__powerpc64__) || defined(__powerpc32__)'
check.

This patch fixes the same by ensuring that these variables are only
declared for archs != powerpc.

Signed-off-by: Bhupesh Sharma <bhsharma at redhat.com>
---
 makedumpfile.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 6d5fc8b95415..7ce0c6d648aa 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -9437,15 +9437,15 @@ exclude_xen_user_domain(void)
 int
 initial_xen(void)
 {
-	int xen_info_required = TRUE;
-	off_t offset;
-	unsigned long size;
-
 #if defined(__powerpc64__) || defined(__powerpc32__)
 	MSG("\n");
 	MSG("Xen is not supported on powerpc.\n");
 	return FALSE;
 #else
+	int xen_info_required = TRUE;
+	off_t offset;
+	unsigned long size;
+
 #ifndef __x86_64__
 	if (DL_EXCLUDE_ZERO < info->max_dump_level) {
 		MSG("Dump_level is invalid. It should be 0 or 1.\n");
-- 
2.7.4




More information about the kexec mailing list