Bug 965022 - Define MOZ_FORMAT_PRINTF(...) macro which expands to __attribute__(format(printf, ...)) where supported. r=froydnj
☠☠ backed out by 894b7372561d ☠ ☠
authorBotond Ballo <botond@mozilla.com>
Mon, 25 Aug 2014 16:00:29 -0400
changeset 201731 f076faf3c282c1d856a078e1bd4f27292ca4b1f9
parent 201730 a50d9d53bdfff97f0e62bd4a718abbdd87ca128a
child 201732 f747fd154739dbf37461c84bf41b365d9463ea44
push id27380
push userkwierso@gmail.com
push dateWed, 27 Aug 2014 00:50:11 +0000
treeherdermozilla-central@83289be2cd12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs965022
milestone34.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 965022 - Define MOZ_FORMAT_PRINTF(...) macro which expands to __attribute__(format(printf, ...)) where supported. r=froydnj
xpcom/base/nscore.h
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -172,16 +172,26 @@
 # define MOZ_DEPRECATED __attribute__((deprecated))
 #elif defined(_MSC_VER)
 # define MOZ_DEPRECATED __declspec(deprecated)
 #else
 # define MOZ_DEPRECATED
 #endif
 
 /**
+ * Printf style formats
+ */
+#ifdef __GNUC__
+#define MOZ_FORMAT_PRINTF(stringIndex, firstToCheck)  \
+    __attribute__ ((format (printf, stringIndex, firstToCheck)))
+#else
+#define MOZ_FORMAT_PRINTF(stringIndex, firstToCheck)
+#endif
+
+/**
  * Generic API modifiers which return the standard XPCOM nsresult type
  */
 #define NS_IMETHOD          NS_IMETHOD_(nsresult)
 #define NS_IMETHODIMP       NS_IMETHODIMP_(nsresult)
 #define NS_METHOD           NS_METHOD_(nsresult)
 #define NS_CALLBACK(_name)  NS_CALLBACK_(nsresult, _name)
 
 /**