Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/libraries/source/spidermonkey/StandardDbgMacro.diff
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
# HG changeset patch | |||||
# User Jeff Walden <jwalden@mit.edu> | |||||
# Date 1582109071 0 | |||||
# Node ID 0f4fc4e582d369244c46b28ee9f86d0b02dc9e39 | |||||
# Parent 2779aefcb6c5e2d1cedaf974fe67b30fbf7805d0 | |||||
Bug 1614243 - Make mfbt/DbgMacro.h use standard variadic macro syntax, not gcc/clang extension syntax. r=froydnj | |||||
Differential Revision: https://phabricator.services.mozilla.com/D63283 | |||||
diff --git a/mfbt/DbgMacro.h b/mfbt/DbgMacro.h | |||||
--- a/mfbt/DbgMacro.h | |||||
+++ b/mfbt/DbgMacro.h | |||||
@@ -167,18 +167,18 @@ std::ostream& operator<<(std::ostream& a | |||||
// B b1 = B(); // fine, initializes b1 directly | |||||
// | |||||
// B b2 = MOZ_DBG(B()); // compile error: MOZ_DBG needs to materialize a | |||||
// // temporary for B() so it can be passed to | |||||
// // operator<<, but that temporary is returned from | |||||
// // MOZ_DBG as an rvalue reference and so wants to | |||||
// // invoke B's move constructor to initialize b2 | |||||
#ifndef MOZILLA_OFFICIAL | |||||
-# define MOZ_DBG(expression_...) \ | |||||
- mozilla::detail::MozDbg(__FILE__, __LINE__, #expression_, expression_) | |||||
+# define MOZ_DBG(...) \ | |||||
+ mozilla::detail::MozDbg(__FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__) | |||||
#endif | |||||
// Helper macro for MOZ_DEFINE_DBG. | |||||
#define MOZ_DBG_FIELD(name_) << #name_ << " = " << aValue.name_ | |||||
// Macro to define an operator<<(ostream&) for a struct or class that displays | |||||
// the type name and the values of the specified member variables. Must be | |||||
// called inside the struct or class. | |||||
@@ -189,18 +189,18 @@ std::ostream& operator<<(std::ostream& a | |||||
// float x; | |||||
// float y; | |||||
// | |||||
// MOZ_DEFINE_DBG(Point, x, y) | |||||
// }; | |||||
// | |||||
// generates an operator<< that outputs strings like | |||||
// "Point { x = 1.0, y = 2.0 }". | |||||
-#define MOZ_DEFINE_DBG(type_, members_...) \ | |||||
+#define MOZ_DEFINE_DBG(type_, ...) \ | |||||
friend std::ostream& operator<<(std::ostream& aOut, const type_& aValue) { \ | |||||
return aOut << #type_ \ | |||||
- << (MOZ_ARG_COUNT(members_) == 0 ? "" : " { ") \ | |||||
+ << (MOZ_ARG_COUNT(__VA_ARGS__) == 0 ? "" : " { ") \ | |||||
MOZ_FOR_EACH_SEPARATED(MOZ_DBG_FIELD, (<< ", "), (), \ | |||||
- (members_)) \ | |||||
- << (MOZ_ARG_COUNT(members_) == 0 ? "" : " }"); \ | |||||
+ (__VA_ARGS__)) \ | |||||
+ << (MOZ_ARG_COUNT(__VA_ARGS__) == 0 ? "" : " }"); \ | |||||
} | |||||
#endif // mozilla_DbgMacro_h | |||||
Wildfire Games · Phabricator