From 8bfb29740f376df94f0f73d8aa06114a833f8c4c Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 3 Aug 2015 14:01:31 -0400 Subject: [PATCH] Removed inline ASM for GCC. According to the GCC devs, the cast to volatile is all that's required --- smartptr.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/smartptr.h b/smartptr.h index 909afd07..4afd48d1 100644 --- a/smartptr.h +++ b/smartptr.h @@ -34,15 +34,6 @@ template simple_ptr::~simple_ptr() { delete m_p; *((volatile T**)(&m_p)) = 0; - - // Ensure the assignment is always performed. MSVC and Clang provide expected - // operational behavior for volatile. GCC has a more strict interpretation of - // the keyword (see http://www.airs.com/blog/archives/154), and volatile - // should not be used to tame the optimizer. However, inline assembly - // will tame it (see https://gcc.gnu.org/ml/gcc-help/2015-07/msg00053.html). -#ifdef __GNUC__ - asm volatile ("" : : : "memory"); -#endif } template class member_ptr @@ -66,10 +57,6 @@ public: T *old_p = m_p; *((volatile T**)(&m_p)) = 0; return old_p; - -#ifdef __GNUC__ - asm volatile ("" : : : "memory"); -#endif } void reset(T *p = 0);