[binutils-gdb] PR24028, PPC_INT_FMT

Alan Modra amodra@sourceware.org
Fri Dec 28 04:33:00 GMT 2018


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d1a3c973fa1c0d7eead585e82e02db11daeb36cf

commit d1a3c973fa1c0d7eead585e82e02db11daeb36cf
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Dec 28 09:31:42 2018 +1030

    PR24028, PPC_INT_FMT
    
    PPC_INT_FMT is redundant now that bfd.h pulls in inttypes.h if
    available.  Apparently MacOS Mojave defines int64_t as long long even
    though long is also 64 bits, which confuses the logic selecting
    PPC_INT_FMT (and BFD_PRI64 too).  Hopefully inttypes.h is available on
    Mojave.
    
    	PR 24028
    include/
    	* opcode/ppc.h (PPC_INT_FMT): Delete.
    opcodes/
    	* ppc-dis.c (print_insn_powerpc): Replace PPC_INT_FMT uses with
    	PRId64/PRIx64.

Diff:
---
 include/ChangeLog    |  5 +++++
 include/opcode/ppc.h |  8 --------
 opcodes/ChangeLog    |  6 ++++++
 opcodes/ppc-dis.c    | 20 ++++++++++----------
 4 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/include/ChangeLog b/include/ChangeLog
index 5e6ed7e..53c423b 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-28  Alan Modra  <amodra@gmail.com>
+
+	PR 24028
+	* opcode/ppc.h (PPC_INT_FMT): Delete.
+
 2018-12-14  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/23900
diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h
index c7262f1..c6b978e 100644
--- a/include/opcode/ppc.h
+++ b/include/opcode/ppc.h
@@ -30,14 +30,6 @@ extern "C" {
 
 typedef uint64_t ppc_cpu_t;
 
-#if BFD_HOST_64BIT_LONG
-# define PPC_INT_FMT "l"
-#elif defined (__MSVCRT__)
-# define PPC_INT_FMT "I64"
-#else
-# define PPC_INT_FMT "ll"
-#endif
-
 /* The opcode table is an array of struct powerpc_opcode.  */
 
 struct powerpc_opcode
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 8676f5f..4fa14fd 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-28  Alan Modra  <amodra@gmail.com>
+
+	PR 24028
+	* ppc-dis.c (print_insn_powerpc): Replace PPC_INT_FMT uses with
+	PRId64/PRIx64.
+
 2018-12-18  Alan Modra  <amodra@gmail.com>
 
 	* arm-dis.c: Include bfd.h.
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index adbd124..c618ecf 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -761,27 +761,27 @@ print_insn_powerpc (bfd_vma memaddr,
 	  /* Print the operand as directed by the flags.  */
 	  if ((operand->flags & PPC_OPERAND_GPR) != 0
 	      || ((operand->flags & PPC_OPERAND_GPR_0) != 0 && value != 0))
-	    (*info->fprintf_func) (info->stream, "r%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "r%" PRId64, value);
 	  else if ((operand->flags & PPC_OPERAND_FPR) != 0)
-	    (*info->fprintf_func) (info->stream, "f%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "f%" PRId64, value);
 	  else if ((operand->flags & PPC_OPERAND_VR) != 0)
-	    (*info->fprintf_func) (info->stream, "v%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "v%" PRId64, value);
 	  else if ((operand->flags & PPC_OPERAND_VSR) != 0)
-	    (*info->fprintf_func) (info->stream, "vs%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "vs%" PRId64, value);
 	  else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0)
 	    (*info->print_address_func) (memaddr + value, info);
 	  else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
 	    (*info->print_address_func) ((bfd_vma) value & 0xffffffff, info);
 	  else if ((operand->flags & PPC_OPERAND_FSL) != 0)
-	    (*info->fprintf_func) (info->stream, "fsl%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "fsl%" PRId64, value);
 	  else if ((operand->flags & PPC_OPERAND_FCR) != 0)
-	    (*info->fprintf_func) (info->stream, "fcr%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "fcr%" PRId64, value);
 	  else if ((operand->flags & PPC_OPERAND_UDI) != 0)
-	    (*info->fprintf_func) (info->stream, "%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "%" PRId64, value);
 	  else if ((operand->flags & PPC_OPERAND_CR_REG) != 0
 		   && (((dialect & PPC_OPCODE_PPC) != 0)
 		       || ((dialect & PPC_OPCODE_VLE) != 0)))
-	    (*info->fprintf_func) (info->stream, "cr%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "cr%" PRId64, value);
 	  else if (((operand->flags & PPC_OPERAND_CR_BIT) != 0)
 		   && (((dialect & PPC_OPCODE_PPC) != 0)
 		       || ((dialect & PPC_OPCODE_VLE) != 0)))
@@ -797,7 +797,7 @@ print_insn_powerpc (bfd_vma memaddr,
 	      (*info->fprintf_func) (info->stream, "%s", cbnames[cc]);
 	    }
 	  else
-	    (*info->fprintf_func) (info->stream, "%" PPC_INT_FMT "d", value);
+	    (*info->fprintf_func) (info->stream, "%" PRId64, value);
 
 	  if (need_paren)
 	    {
@@ -819,7 +819,7 @@ print_insn_powerpc (bfd_vma memaddr,
     }
 
   /* We could not find a match.  */
-  (*info->fprintf_func) (info->stream, ".long 0x%" PPC_INT_FMT "x", insn);
+  (*info->fprintf_func) (info->stream, ".long 0x%" PRIx64, insn);
 
   return 4;
 }



More information about the Binutils-cvs mailing list