Give LinkedListElement a thisDuringConstruction() method, and use it in member initialization to silence an MSVC compiler warning. No bug, r=sparky
authorJeff Walden <jwalden@mit.edu>
Thu, 18 Oct 2012 18:39:54 -0700
changeset 118732 d5e23f4018c67d62d9c393544fae0c6f8e7c5f8b
parent 118731 db769c0adc2a52dd6c9e994f47466106a28ceb1d
child 118733 499ca9ee03bca43676218bbf5dba8e55f100a362
push id1997
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 21:25:26 +0000
treeherdermozilla-beta@4baf45cdcf21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssparky
milestone19.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
Give LinkedListElement a thisDuringConstruction() method, and use it in member initialization to silence an MSVC compiler warning. No bug, r=sparky
mfbt/LinkedList.h
--- a/mfbt/LinkedList.h
+++ b/mfbt/LinkedList.h
@@ -96,18 +96,24 @@ class LinkedListElement
      * lists, and supporting this painlessly was a key design criterion.
      */
 
   private:
     LinkedListElement* next;
     LinkedListElement* prev;
     const bool isSentinel;
 
+    LinkedListElement* thisDuringConstruction() { return this; }
+
   public:
-    LinkedListElement() : next(this), prev(this), isSentinel(false) { }
+    LinkedListElement()
+      : next(thisDuringConstruction()),
+        prev(thisDuringConstruction()),
+        isSentinel(false)
+    { }
 
     /*
      * Get the next element in the list, or NULL if this is the last element in
      * the list.
      */
     T* getNext() {
       return next->asT();
     }