Add gcc-style annotations for printf-like functions.

Bug: None
Change-Id: I37a553d254cb61a882b98b14274c0fdfba039992
Reviewed-on: https://webrtc-review.googlesource.com/33002
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21281}
diff --git a/media/sctp/sctptransport.cc b/media/sctp/sctptransport.cc
index 45db637..e893c03 100644
--- a/media/sctp/sctptransport.cc
+++ b/media/sctp/sctptransport.cc
@@ -132,6 +132,9 @@
 }
 
 // Helper for logging SCTP messages.
+#if defined(__GNUC__)
+__attribute__((__format__(__printf__, 1, 2)))
+#endif
 void DebugSctpPrintf(const char* format, ...) {
 #if RTC_DCHECK_IS_ON
   char s[255];
diff --git a/modules/remote_bitrate_estimator/test/bwe_test_logging.h b/modules/remote_bitrate_estimator/test/bwe_test_logging.h
index e375ad6..325beb7 100644
--- a/modules/remote_bitrate_estimator/test/bwe_test_logging.h
+++ b/modules/remote_bitrate_estimator/test/bwe_test_logging.h
@@ -277,6 +277,10 @@
   void SetGlobalContext(const char* name);
   void SetGlobalEnable(bool enabled);
 
+#if defined(__GNUC__)
+  // Note: Implicit |this| argument counts as the first argument.
+  __attribute__((__format__(__printf__, 2, 3)))
+#endif
   void Log(const char format[], ...);
   void Plot(int figure, const std::string& name, double value);
   void Plot(int figure,
diff --git a/modules/remote_bitrate_estimator/test/metric_recorder.cc b/modules/remote_bitrate_estimator/test/metric_recorder.cc
index eeb5efb..612ad4a 100644
--- a/modules/remote_bitrate_estimator/test/metric_recorder.cc
+++ b/modules/remote_bitrate_estimator/test/metric_recorder.cc
@@ -10,6 +10,8 @@
 
 #include "modules/remote_bitrate_estimator/test/metric_recorder.h"
 
+#include <inttypes.h>
+
 #include <algorithm>
 
 #include "modules/remote_bitrate_estimator/test/packet_sender.h"
@@ -321,10 +323,12 @@
   // Log added latency, disregard baseline path delay.
   BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay average : ",
                         "%lf ms", average_delay_ms - one_way_path_delay_ms);
-  BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 5th percentile : ",
-                        "%ld ms", percentile_5_ms - one_way_path_delay_ms);
-  BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 95th percentile : ",
-                        "%ld ms", percentile_95_ms - one_way_path_delay_ms);
+  BWE_TEST_LOGGING_LOG1(
+      "RESULTS >>> " + bwe_name + " Delay 5th percentile : ", "%" PRId64 " ms",
+      percentile_5_ms - one_way_path_delay_ms);
+  BWE_TEST_LOGGING_LOG1(
+      "RESULTS >>> " + bwe_name + " Delay 95th percentile : ", "%" PRId64 " ms",
+      percentile_95_ms - one_way_path_delay_ms);
 
   RTC_UNUSED(average_delay_ms);
   RTC_UNUSED(percentile_5_ms);
diff --git a/rtc_base/testutils.h b/rtc_base/testutils.h
index d901f82..9b372dc 100644
--- a/rtc_base/testutils.h
+++ b/rtc_base/testutils.h
@@ -175,6 +175,10 @@
   void QueueString(const char* data) {
     QueueData(data, strlen(data));
   }
+#if defined(__GNUC__)
+  // Note: Implicit |this| argument counts as the first argument.
+  __attribute__((__format__(__printf__, 2, 3)))
+#endif
   void QueueStringF(const char* format, ...) {
     va_list args;
     va_start(args, format);