Bug 553032 - use MOZ_FORMAT_PRINTF, not explicit attribute; r=froydnj
authorTom Tromey <tom@tromey.com>
Wed, 12 Oct 2016 10:03:53 -0600
changeset 361805 65a272de7edaa23804374e6a9d390fe82ed20cbc
parent 361804 7ece94001875a0fee5866091a70eb746fb0a4240
child 361806 cf0ce58e21e13a32cba1a3f2e96407233323c268
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-beta@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs553032
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 553032 - use MOZ_FORMAT_PRINTF, not explicit attribute; r=froydnj MozReview-Commit-ID: FgGin8L5oTp
js/src/builtin/Profilers.cpp
js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
mfbt/Sprintf.h
--- a/js/src/builtin/Profilers.cpp
+++ b/js/src/builtin/Profilers.cpp
@@ -36,19 +36,17 @@ using namespace js;
 using mozilla::ArrayLength;
 
 /* Thread-unsafe error management */
 
 static char gLastError[2000];
 
 #if defined(__APPLE__) || defined(__linux__) || defined(MOZ_CALLGRIND)
 static void
-#ifdef __GNUC__
-__attribute__((format(printf,1,2)))
-#endif
+MOZ_FORMAT_PRINTF(1, 2)
 UnsafeError(const char* format, ...)
 {
     va_list args;
     va_start(args, format);
     (void) VsprintfLiteral(gLastError, format, args);
     va_end(args);
 }
 #endif
--- a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
+++ b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
@@ -181,20 +181,17 @@ namespace jit {
         GenericAssembler()
           : printer(NULL)
         {}
 
         void setPrinter(Sprinter* sp) {
             printer = sp;
         }
 
-        void spew(const char* fmt, ...)
-#ifdef __GNUC__
-            __attribute__ ((format (printf, 2, 3)))
-#endif
+        void spew(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3)
         {
             if (MOZ_UNLIKELY(printer || JitSpewEnabled(JitSpew_Codegen))) {
                 va_list va;
                 va_start(va, fmt);
                 spew(fmt, va);
                 va_end(va);
             }
         }
--- a/mfbt/Sprintf.h
+++ b/mfbt/Sprintf.h
@@ -8,32 +8,31 @@
 
 #ifndef mozilla_Sprintf_h_
 #define mozilla_Sprintf_h_
 
 #include <stdio.h>
 #include <stdarg.h>
 
 #include "mozilla/Assertions.h"
+#include "mozilla/Attributes.h"
 
 #ifdef __cplusplus
 
 template <size_t N>
 int VsprintfLiteral(char (&buffer)[N], const char* format, va_list args)
 {
     MOZ_ASSERT(format != buffer);
     int result = vsnprintf(buffer, N, format, args);
     buffer[N - 1] = '\0';
     return result;
 }
 
 template <size_t N>
-#if defined(__GNUC__)
-  __attribute__((format(printf, 2, 3)))
-#endif
+MOZ_FORMAT_PRINTF(2, 3)
 int SprintfLiteral(char (&buffer)[N], const char* format, ...)
 {
   va_list args;
   va_start(args, format);
   int result = VsprintfLiteral(buffer, format, args);
   va_end(args);
   return result;
 }