summaryrefslogtreecommitdiff
path: root/smartptr.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-08-01 19:00:31 -0400
committerJeffrey Walton <noloader@gmail.com>2015-08-01 19:00:31 -0400
commitb44546be11c235c108a97c798fd6602c7cdaa400 (patch)
tree639ee6546a1e04d6ac2ac425aae0725d2e7e5b36 /smartptr.h
parent390d27b6cddcc82145352034354e5c0fa39ab821 (diff)
downloadcryptopp-git-b44546be11c235c108a97c798fd6602c7cdaa400.tar.gz
Revert "Hid inline assembly behind a macro". The MEMORY_BARRIER code is OK, and the use of inline assembly code is OK to tame the optimizer is OK; but its confusing because the interactions are not readily apparent.
Diffstat (limited to 'smartptr.h')
-rw-r--r--smartptr.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/smartptr.h b/smartptr.h
index db5441fe..057f5213 100644
--- a/smartptr.h
+++ b/smartptr.h
@@ -3,7 +3,6 @@
#include "config.h"
#include "stdcpp.h"
-#include "misc.h"
#include "trap.h"
NAMESPACE_BEGIN(CryptoPP)
@@ -52,8 +51,11 @@ template <class T> simple_ptr<T>::~simple_ptr()
delete m_p;
m_p = NULL;
- // https://github.com/weidai11/cryptopp/issues/6
- MEMORY_BARRIER();
+#ifdef __GNUC__
+ // From Andrew Haley (GCC Dev), to tame the optimizer so the assignment is always performed.
+ // See "Disable optimizations in one function" on the GCC mailing list.
+ asm volatile ("" : : : "memory");
+#endif
}
template <class T> class member_ptr