<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 19, 2010, at 11:02 AM, Owen Anderson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: resistor<br>Date: Tue Oct 19 13:02:06 2010<br>New Revision: 116832<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=116832&view=rev">http://llvm.org/viewvc/llvm-project?rev=116832&view=rev</a><br>Log:<br>Factor out the call-once implementation into its own macro.<br><br>Modified:<br>    llvm/trunk/include/llvm/PassSupport.h<br><br>Modified: llvm/trunk/include/llvm/PassSupport.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=116832&r1=116831&r2=116832&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=116832&r1=116831&r2=116832&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/PassSupport.h (original)<br>+++ llvm/trunk/include/llvm/PassSupport.h Tue Oct 19 13:02:06 2010<br>@@ -129,6 +129,22 @@<br>   PassInfo(const PassInfo &);       // do not implement<br> };<br><br>+#define CALL_ONCE_INITIALIZATION(function) \<br>+  static volatile sys::cas_flag initialized = 0; \<br>+  sys::cas_flag old_val = sys::CompareAndSwap(&initialized, 1, 0); \<br>+  if (old_val == 0) { \<br>+    function(Registry); \<br>+    sys::MemoryFence(); \<br>+    initialized = 2; \<br>+  } else { \<br>+    sys::cas_flag tmp = initialized; \<br>+    sys::MemoryFence(); \<br>+    while (tmp != 2) { \<br>+      tmp = initialized; \<br>+      sys::MemoryFence(); \<br>+    } \<br>+  } \<br>+<br></div></blockquote><div><br></div><div>Could you remove the final backslash here? It's not needed and relies upon proper spacing in the file. (And is a pet peeve of mine. :-)</div><div><br></div><div>-bw</div><div><br></div></div></body></html>