Bug 1369622 - Use MOZ_ARG_COUNT instead of MOZ_PASTE_PREFIX_AND_ARG_COUNT. r?froydnj draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 02 Jun 2017 15:06:34 +0900
changeset 588095 6947d24ec141c30cdc59ac98f1a6535b58853b01
parent 588094 b357be8b7773a94dbf31c49974cde0da311aebeb
child 588096 dbf0550621ba1346d6fe2332c54104fb9912fe81
push id61910
push userbmo:mh+mozilla@glandium.org
push dateFri, 02 Jun 2017 06:13:28 +0000
reviewersfroydnj
bugs1369622
milestone55.0a1
Bug 1369622 - Use MOZ_ARG_COUNT instead of MOZ_PASTE_PREFIX_AND_ARG_COUNT. r?froydnj In a couple places, MOZ_PASTE_PREFIX_AND_ARG_COUNT is used to only count the number of arguments, we can now use MOZ_ARG_COUNT directly for that.
mfbt/Assertions.h
xpcom/base/nsIClassInfoImpl.h
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -310,17 +310,17 @@ MOZ_CrashPrintf(const char* aFilename, i
  * a printf-style format string, which must be a string literal and between
  * 1 and 4 additional arguments. A regular MOZ_CRASH() is preferred wherever
  * possible, as passing arbitrary strings to printf from a potentially
  * compromised process is not without risk.
  */
 #define MOZ_CRASH_UNSAFE_PRINTF(format, ...) \
    do { \
      static_assert( \
-       MOZ_PASTE_PREFIX_AND_ARG_COUNT(, __VA_ARGS__) <= sPrintfMaxArgs, \
+       MOZ_ARG_COUNT(__VA_ARGS__) <= sPrintfMaxArgs, \
        "Only up to 4 additional arguments are allowed!"); \
      static_assert(sizeof(format) <= sPrintfCrashReasonSize, \
        "The supplied format string is too long!"); \
      MOZ_CALL_CRASH_PRINTF("" format, __VA_ARGS__); \
    } while (0)
 
 MOZ_END_EXTERN_C
 
--- a/xpcom/base/nsIClassInfoImpl.h
+++ b/xpcom/base/nsIClassInfoImpl.h
@@ -151,19 +151,17 @@ NS_CI_INTERFACE_GETTER_NAME(_class)(uint
                                             sizeof(nsIID));
 
 #define NS_CLASSINFO_HELPER_END                                               \
     MOZ_ASSERT(i == *count, "Incorrent number of entries");                   \
     return NS_OK;                                                             \
 }
 
 #define NS_IMPL_CI_INTERFACE_GETTER(aClass, ...)                              \
-  NS_CLASSINFO_HELPER_BEGIN(aClass,                                           \
-                            MOZ_PASTE_PREFIX_AND_ARG_COUNT(/* No prefix */,   \
-                                                           __VA_ARGS__))      \
+  NS_CLASSINFO_HELPER_BEGIN(aClass, MOZ_ARG_COUNT(__VA_ARGS__))               \
     MOZ_FOR_EACH(NS_CLASSINFO_HELPER_ENTRY, (), (__VA_ARGS__))                \
   NS_CLASSINFO_HELPER_END
 
 #define NS_IMPL_QUERY_INTERFACE_CI(aClass, ...)                               \
   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)                                           \