Bug 900908 - Part 2: Add variadic variants of numbered macros in nsIClassInfoImpl.h. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 24 Apr 2014 11:21:00 +0200
changeset 198599 e4f8969d11422863be77c4842a64e609a4c8d42d
parent 198598 3b6b08c9a5a0659511cdd03e05e0498252ea7ed4
child 198600 c7399918527aae630408026e801464308a95419c
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs900908
milestone31.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 900908 - Part 2: Add variadic variants of numbered macros in nsIClassInfoImpl.h. r=froydnj The old numbered macros are still present, but simply forward to the variadic macro. They will be removed after all instances of the numbered macros have been converted.
xpcom/glue/nsIClassInfoImpl.h
--- a/xpcom/glue/nsIClassInfoImpl.h
+++ b/xpcom/glue/nsIClassInfoImpl.h
@@ -1,16 +1,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsIClassInfoImpl_h__
 #define nsIClassInfoImpl_h__
 
 #include "mozilla/Alignment.h"
+#include "mozilla/Assertions.h"
+#include "mozilla/MacroArgs.h"
+#include "mozilla/MacroForEach.h"
 #include "nsIClassInfo.h"
 #include "nsISupportsImpl.h"
 
 #include <new>
 
 /**
  * This header file provides macros which help you make your class implement
  * nsIClassInfo.  Implementing nsIClassInfo is particularly helpful if you have
@@ -131,346 +134,115 @@ private:
     foundInterface = NS_CLASSINFO_NAME(_class);                               \
   } else
 
 #define NS_CLASSINFO_HELPER_BEGIN(_class, _c)                                 \
 NS_IMETHODIMP                                                                 \
 NS_CI_INTERFACE_GETTER_NAME(_class)(uint32_t *count, nsIID ***array)          \
 {                                                                             \
     *count = _c;                                                              \
-    *array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c);
+    *array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c);                \
+    uint32_t i = 0;
 
-#define NS_CLASSINFO_HELPER_ENTRY(_i, _interface)                             \
-    (*array)[_i] = (nsIID *)nsMemory::Clone(&NS_GET_IID(_interface),          \
+#define NS_CLASSINFO_HELPER_ENTRY(_interface)                                 \
+    (*array)[i++] = (nsIID*)nsMemory::Clone(&NS_GET_IID(_interface),          \
                                             sizeof(nsIID));
 
 #define NS_CLASSINFO_HELPER_END                                               \
+    MOZ_ASSERT(i == *count, "Incorrent number of entries");                   \
     return NS_OK;                                                             \
 }
 
-#define NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface)                      \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 1)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _interface)                                 \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE1_CI(_class, _i1)                              \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS1_CI(_class, _interface)                             \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE1_CI(_class, _interface)                             \
-  NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface)
-
-#define NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2)                        \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 2)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2)                         \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS2_CI(_class, _i1, _i2)                               \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE2_CI(_class, _i1, _i2)                               \
-  NS_IMPL_CI_INTERFACE_GETTER2(_class, _i1, _i2)
-
-#define NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3)                   \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 3)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3)                    \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS3_CI(_class, _i1, _i2, _i3)                          \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE3_CI(_class, _i1, _i2, _i3)                          \
-  NS_IMPL_CI_INTERFACE_GETTER3(_class, _i1, _i2, _i3)
-
-#define NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4)              \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 4)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4)               \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
+#define NS_IMPL_CI_INTERFACE_GETTER(aClass, ...)                              \
+  MOZ_STATIC_ASSERT_VALID_ARG_COUNT(__VA_ARGS__);                             \
+  NS_CLASSINFO_HELPER_BEGIN(aClass,                                           \
+                            MOZ_PASTE_PREFIX_AND_ARG_COUNT(/* No prefix */,   \
+                                                           __VA_ARGS__))      \
+    MOZ_FOR_EACH(NS_CLASSINFO_HELPER_ENTRY, (), (__VA_ARGS__))                \
+  NS_CLASSINFO_HELPER_END
 
-#define NS_IMPL_ISUPPORTS4_CI(_class, _i1, _i2, _i3, _i4)                     \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE4_CI(_class, _i1, _i2, _i3, _i4)                     \
-  NS_IMPL_CI_INTERFACE_GETTER4(_class, _i1, _i2, _i3, _i4)
-
-#define NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5)         \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 5)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(4, _i5)                                        \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5)          \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i5)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS5_CI(_class, _i1, _i2, _i3, _i4, _i5)                \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE5_CI(_class, _i1, _i2, _i3, _i4, _i5)                \
-  NS_IMPL_CI_INTERFACE_GETTER5(_class, _i1, _i2, _i3, _i4, _i5)
-
-#define NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6)    \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 6)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(4, _i5)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(5, _i6)                                        \
-   NS_CLASSINFO_HELPER_END
+// TODO: Remove these after changing everything to the variadic variant.
+#define NS_IMPL_CI_INTERFACE_GETTER1(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER2(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER3(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER4(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER5(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER6(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER7(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER8(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER9(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER10(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
+#define NS_IMPL_CI_INTERFACE_GETTER11(aClass, ...) \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
 
-#define NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6)     \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i5)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i6)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6)           \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE6_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6)           \
-  NS_IMPL_CI_INTERFACE_GETTER6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
-
-#define NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
-                                     _i7)                                     \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 7)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(4, _i5)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(5, _i6)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(6, _i7)                                        \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,     \
-                                    _i7)                                      \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i5)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i6)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i7)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
+#define NS_IMPL_QUERY_INTERFACE_CI(aClass, ...)                               \
+  MOZ_STATIC_ASSERT_VALID_ARG_COUNT(__VA_ARGS__);                             \
+  NS_INTERFACE_MAP_BEGIN(aClass)                                              \
+    MOZ_FOR_EACH(NS_INTERFACE_MAP_ENTRY, (), (__VA_ARGS__))                   \
+    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, MOZ_ARG_1(__VA_ARGS__))     \
+    NS_IMPL_QUERY_CLASSINFO(aClass)                                           \
   NS_INTERFACE_MAP_END
 
-#define NS_IMPL_ISUPPORTS7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)      \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE7_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)      \
-  NS_IMPL_CI_INTERFACE_GETTER7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
-
-#define NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
-                                     _i7, _i8)                                \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 8)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(4, _i5)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(5, _i6)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(6, _i7)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(7, _i8)                                        \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,     \
-                                    _i7, _i8)                                 \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i5)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i6)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i7)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i8)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE8_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
-  NS_IMPL_CI_INTERFACE_GETTER8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
-
-#define NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
-                                     _i7, _i8, _i9)                           \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 9)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(4, _i5)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(5, _i6)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(6, _i7)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(7, _i8)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(8, _i9)                                        \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,     \
-                                    _i7, _i8, _i9)                            \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i5)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i6)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i7)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i8)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i9)                                               \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,      \
-                              _i8, _i9)                                       \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE9_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,      \
-                              _i8, _i9)                                       \
-  NS_IMPL_CI_INTERFACE_GETTER9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
-                               _i8, _i9)
+// TODO: Remove these after changing everything to the variadic variant.
+#define NS_IMPL_QUERY_INTERFACE1_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE2_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE3_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE4_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE5_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE6_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE7_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE8_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE9_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE10_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_QUERY_INTERFACE11_CI(aClass, ...) \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)
 
-#define NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6,   \
-                                      _i7, _i8, _i9, _i10)                    \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 10)                                      \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(4, _i5)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(5, _i6)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(6, _i7)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(7, _i8)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(8, _i9)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(9, _i10)                                       \
-   NS_CLASSINFO_HELPER_END
-
-#define NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6,   \
-                                      _i7, _i8, _i9, _i10, _i11)              \
-   NS_CLASSINFO_HELPER_BEGIN(_class, 11)                                      \
-     NS_CLASSINFO_HELPER_ENTRY(0, _i1)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(1, _i2)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(2, _i3)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(3, _i4)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(4, _i5)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(5, _i6)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(6, _i7)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(7, _i8)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(8, _i9)                                        \
-     NS_CLASSINFO_HELPER_ENTRY(9, _i10)                                       \
-     NS_CLASSINFO_HELPER_ENTRY(10, _i11)                                      \
-   NS_CLASSINFO_HELPER_END
+#define NS_IMPL_ISUPPORTS_CI(aClass, ...)                                     \
+  NS_IMPL_ADDREF(aClass)                                                      \
+  NS_IMPL_RELEASE(aClass)                                                     \
+  NS_IMPL_QUERY_INTERFACE_CI(aClass, __VA_ARGS__)                             \
+  NS_IMPL_CI_INTERFACE_GETTER(aClass, __VA_ARGS__)
 
-#define NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
-                                     _i7, _i8, _i9, _i10)                     \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i5)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i6)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i7)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i8)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i9)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i10)                                              \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6,    \
-                                     _i7, _i8, _i9, _i10, _i11)               \
-  NS_INTERFACE_MAP_BEGIN(_class)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i1)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i2)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i3)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i4)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i5)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i6)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i7)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i8)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i9)                                               \
-    NS_INTERFACE_MAP_ENTRY(_i10)                                              \
-    NS_INTERFACE_MAP_ENTRY(_i11)                                              \
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1)                        \
-    NS_IMPL_QUERY_CLASSINFO(_class)                                           \
-  NS_INTERFACE_MAP_END
-
-#define NS_IMPL_ISUPPORTS10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
-                               _i8, _i9, _i10)                                \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
-                               _i8, _i9, _i10)                                \
-  NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,    \
-                                _i8, _i9, _i10)
-
-#define NS_IMPL_ISUPPORTS11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
-                               _i8, _i9, _i10, _i11)                          \
-  NS_IMPL_ADDREF(_class)                                                      \
-  NS_IMPL_RELEASE(_class)                                                     \
-  NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,     \
-                               _i8, _i9, _i10, _i11)                          \
-  NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7,    \
-                                _i8, _i9, _i10, _i11)
+// TODO: Remove these after changing everything to the variadic variant.
+#define NS_IMPL_ISUPPORTS1_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS2_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS3_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS4_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS5_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS6_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS7_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS8_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS9_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS10_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
+#define NS_IMPL_ISUPPORTS11_CI(aClass, ...) \
+  NS_IMPL_ISUPPORTS_CI(aClass, __VA_ARGS__)
 
 #endif // nsIClassInfoImpl_h__