[llvm-commits] [llvm] r173711 - Fix gcc/printf/ISO C++ warning

Edwin Vane edwin.vane at intel.com
Mon Jan 28 11:34:42 PST 2013


Author: revane
Date: Mon Jan 28 13:34:42 2013
New Revision: 173711

URL: http://llvm.org/viewvc/llvm-project?rev=173711&view=rev
Log:
Fix gcc/printf/ISO C++ warning

Remove the use of the 't' length modifier to avoid a gcc warning. Based
on usage, 32 bits of precision is good enough for printing a stack
offset for a stack trace.

't' length modifier isn't in C++03 but it *is* in C++11. Added a FIXME
to reintroduce once LLVM makes the switch to C++11.

Reviewer: gribozavr

Modified:
    llvm/trunk/lib/Support/Unix/Signals.inc

Modified: llvm/trunk/lib/Support/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=173711&r1=173710&r2=173711&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Signals.inc (original)
+++ llvm/trunk/lib/Support/Unix/Signals.inc Mon Jan 28 13:34:42 2013
@@ -295,7 +295,11 @@ void llvm::sys::PrintStackTrace(FILE *FD
       else           fputs(d, FD);
       free(d);
 
-      fprintf(FD, " + %tu",(char*)StackTrace[i]-(char*)dlinfo.dli_saddr);
+      // FIXME: When we move to C++11, use %t length modifier. It's not in
+      // C++03 and causes gcc to issue warnings. Losing the upper 32 bits of
+      // the stack offset for a stack dump isn't likely to cause any problems.
+      fprintf(FD, " + %u",(unsigned)((char*)StackTrace[i]-
+                                     (char*)dlinfo.dli_saddr));
     }
     fputc('\n', FD);
   }





More information about the llvm-commits mailing list