Bug 839998 - Introduce MOZ_THIS_IN_INITIALIZER_LIST macro. r=waldo
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 27 Jun 2013 00:15:52 +0900
changeset 149731 6afe0a48ad5e00c8ae35b28c950818c7e31ffecd
parent 149730 53e925dc3bda9bdfd9a2044deee068d186d20276
child 149732 d19ecc13f95a0c7c5d297a1ad5f5196f6cc62dde
push id382
push userakeybl@mozilla.com
push dateMon, 21 Oct 2013 21:47:13 +0000
treeherdermozilla-release@5f1868ee45cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs839998
milestone25.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 839998 - Introduce MOZ_THIS_IN_INITIALIZER_LIST macro. r=waldo
mfbt/Attributes.h
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -399,11 +399,25 @@
 # define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
 # define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
 #else
 # define MOZ_MUST_OVERRIDE /* nothing */
 # define MOZ_STACK_CLASS /* nothing */
 # define MOZ_NONHEAP_CLASS /* nothing */
 #endif /* MOZ_CLANG_PLUGIN */
 
+/*
+ * MOZ_THIS_IN_INITIALIZER_LIST is used to avoid a warning when we know that
+ * it's safe to use 'this' in an initializer list.
+ */
+#ifdef _MSC_VER
+#  define MOZ_THIS_IN_INITIALIZER_LIST() \
+     __pragma(warning(push)) \
+     __pragma(warning(disable:4355)) \
+     this \
+     __pragma(warning(pop))
+#else
+#  define MOZ_THIS_IN_INITIALIZER_LIST() this
+#endif
+
 #endif /* __cplusplus */
 
 #endif  /* mozilla_Attributes_h_ */