[compiler-rt] r199874 - [sanitizer] Add printf format attributes.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Jan 23 00:58:34 PST 2014


Author: eugenis
Date: Thu Jan 23 02:58:34 2014
New Revision: 199874

URL: http://llvm.org/viewvc/llvm-project?rev=199874&view=rev
Log:
[sanitizer] Add printf format attributes.

These were lost in a refactoring a long time ago.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc?rev=199874&r1=199873&r2=199874&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc Thu Jan 23 02:58:34 2014
@@ -279,6 +279,7 @@ static void SharedPrintfCode(bool append
   va_end(args2);
 }
 
+FORMAT(1, 2)
 void Printf(const char *format, ...) {
   va_list args;
   va_start(args, format);
@@ -287,6 +288,7 @@ void Printf(const char *format, ...) {
 }
 
 // Like Printf, but prints the current PID before the output string.
+FORMAT(1, 2)
 void Report(const char *format, ...) {
   va_list args;
   va_start(args, format);
@@ -298,6 +300,7 @@ void Report(const char *format, ...) {
 // Returns the number of symbols that should have been written to buffer
 // (not including trailing '\0'). Thus, the string is truncated
 // iff return value is not less than "length".
+FORMAT(3, 4)
 int internal_snprintf(char *buffer, uptr length, const char *format, ...) {
   va_list args;
   va_start(args, format);
@@ -306,6 +309,7 @@ int internal_snprintf(char *buffer, uptr
   return needed_length;
 }
 
+FORMAT(2, 3)
 void InternalScopedString::append(const char *format, ...) {
   CHECK_LT(length_, size());
   va_list args;





More information about the llvm-commits mailing list