summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Sohns <eriksohns@fastmail.net>2015-12-04 18:12:35 +0100
committerErik Sohns <eriksohns@fastmail.net>2015-12-04 18:13:34 +0100
commit9ca4697dfeabecba5474e117a0dedf86427bdd51 (patch)
treef8b05bbd9735c934d796ac018766d685008c34af
parent733efc7e1b7366858a4d1621cb8bb3fbaeeedaed (diff)
downloadATCD-9ca4697dfeabecba5474e117a0dedf86427bdd51.tar.gz
fixed an issue with (exported) template specializations (Win32)
-rw-r--r--ACE/ace/Condition_Recursive_Thread_Mutex.h13
-rw-r--r--ACE/ace/config-g++-common.h10
-rw-r--r--ACE/ace/config-win32-msvc-14.h4
-rw-r--r--ACE/tests/Recursive_Condition_Test.cpp3
4 files changed, 21 insertions, 9 deletions
diff --git a/ACE/ace/Condition_Recursive_Thread_Mutex.h b/ACE/ace/Condition_Recursive_Thread_Mutex.h
index 19de7846c64..e3a5a42ef7b 100644
--- a/ACE/ace/Condition_Recursive_Thread_Mutex.h
+++ b/ACE/ace/Condition_Recursive_Thread_Mutex.h
@@ -108,13 +108,16 @@ private:
ACE_Recursive_Thread_Mutex &mutex_;
};
-// *NOTE*: prevent implicit instantiations by includees to relieve the linker
-#if defined (__GNUG__)
-// g++ (5.2.1) does not support attributes on explicit template instantiations
+// prevent implicit instantiations by includers to relieve the linker
+#if defined (ACE_HAS_CPP11_EXTERN_TEMPLATES)
+// suppress a warning, g++ 5.2.1 does not support attributes on template
+// instantiation declarations. *TODO*: this may go back further
+# if defined (__GNUG__) && (__GNUC__ == 5 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 1)
extern template class ACE_Condition<ACE_Recursive_Thread_Mutex>;
-#else
+# else
extern template ACE_Export class ACE_Condition<ACE_Recursive_Thread_Mutex>;
-#endif /* __GNUG__ */
+# endif /* __GNUG__ && (__GNUC__ == 5 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 1) */
+#endif /* ACE_HAS_CPP11_EXTERN_TEMPLATES */
typedef ACE_Condition<ACE_Recursive_Thread_Mutex> ACE_Condition_Recursive_Thread_Mutex;
diff --git a/ACE/ace/config-g++-common.h b/ACE/ace/config-g++-common.h
index e024997f42c..5a0f16d9b87 100644
--- a/ACE/ace/config-g++-common.h
+++ b/ACE/ace/config-g++-common.h
@@ -38,7 +38,15 @@
# if __cplusplus > 201103L
# define ACE_HAS_CPP14
# endif
-#endif
+#endif /* __GNUC__ >= 4.7 */
+
+// *NOTE*: this feature may go back further, see e.g.:
+// https://gcc.gnu.org/projects/cxx0x.html
+#if defined (ACE_HAS_CPP11)
+# if (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+# define ACE_HAS_CPP11_EXTERN_TEMPLATES
+# endif /* __GNUC__ >= 4.3 */
+#endif /* ACE_HAS_CPP11 */
#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
# define ACE_SIZEOF_LONG_DOUBLE 12
diff --git a/ACE/ace/config-win32-msvc-14.h b/ACE/ace/config-win32-msvc-14.h
index e674c970315..daae26f81bc 100644
--- a/ACE/ace/config-win32-msvc-14.h
+++ b/ACE/ace/config-win32-msvc-14.h
@@ -41,6 +41,10 @@
// Visual Studio 2015 has adequate C++11 support
#define ACE_HAS_CPP11
+// *TODO*: this C++11-feature goes back further (at least to MSVC 2010), see:
+// https://msdn.microsoft.com/en-us/library/hh567368.aspx#featurelist
+#define ACE_HAS_CPP11_EXTERN_TEMPLATES
+
#define ACE_PUTENV_EQUIVALENT ::_putenv
#define ACE_TEMPNAM_EQUIVALENT ::_tempnam
#define ACE_STRDUP_EQUIVALENT ::_strdup
diff --git a/ACE/tests/Recursive_Condition_Test.cpp b/ACE/tests/Recursive_Condition_Test.cpp
index 221b29cf07c..394100cd0c6 100644
--- a/ACE/tests/Recursive_Condition_Test.cpp
+++ b/ACE/tests/Recursive_Condition_Test.cpp
@@ -25,9 +25,6 @@
#if defined (ACE_HAS_THREADS)
typedef ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Heap> Thread_Timer_Queue;
-//
-//// *NOTE*: explicit template instantiation required here...
-//template class ACE_Condition<ACE_Recursive_Thread_Mutex>;
class Test_Handler : public ACE_Event_Handler
{