This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

%Ld vs. %lld


As far as I'm aware %Ld isn't specified for __STDC_VERSION__ == 199901.

	* strings.c (print_strings): Don't use %L, use %ll in printf
	format strings.

Index: binutils/strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.36
diff -u -p -r1.36 strings.c
--- binutils/strings.c	5 Jul 2007 16:54:45 -0000	1.36
+++ binutils/strings.c	24 Oct 2007 02:00:08 -0000
@@ -593,14 +593,12 @@ print_strings (const char *filename, FIL
 	  case 8:
 #if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
 	    if (sizeof (start) > sizeof (long))
-	      printf ("%7Lo ", (unsigned long long) start);
+	      printf ("%7llo ", (unsigned long long) start);
 	    else
-#else
-# if !BFD_HOST_64BIT_LONG
+#elif !BFD_HOST_64BIT_LONG
 	    if (start != (unsigned long) start)
 	      printf ("++%7lo ", (unsigned long) start);
 	    else
-# endif
 #endif
 	      printf ("%7lo ", (unsigned long) start);
 	    break;
@@ -608,14 +606,12 @@ print_strings (const char *filename, FIL
 	  case 10:
 #if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
 	    if (sizeof (start) > sizeof (long))
-	      printf ("%7Ld ", (unsigned long long) start);
+	      printf ("%7lld ", (unsigned long long) start);
 	    else
-#else
-# if !BFD_HOST_64BIT_LONG
+#elif !BFD_HOST_64BIT_LONG
 	    if (start != (unsigned long) start)
 	      printf ("++%7ld ", (unsigned long) start);
 	    else
-# endif
 #endif
 	      printf ("%7ld ", (long) start);
 	    break;
@@ -623,15 +619,13 @@ print_strings (const char *filename, FIL
 	  case 16:
 #if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
 	    if (sizeof (start) > sizeof (long))
-	      printf ("%7Lx ", (unsigned long long) start);
+	      printf ("%7llx ", (unsigned long long) start);
 	    else
-#else
-# if !BFD_HOST_64BIT_LONG
+#elif !BFD_HOST_64BIT_LONG
 	    if (start != (unsigned long) start)
 	      printf ("%lx%8.8lx ", (unsigned long) (start >> 32),
 		      (unsigned long) (start & 0xffffffff));
 	    else
-# endif
 #endif
 	      printf ("%7lx ", (unsigned long) start);
 	    break;

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]