summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2011-03-07 13:50:43 +0000
committerrpj <rpj>2011-03-07 13:50:43 +0000
commit2c51bb3337275e134e8c40db6dd4eea9407c8bca (patch)
tree272b3c7662394932a6a095c3d083c15b2eef6d58
parent247469c6f6a16681491ac3ee213e57efcdda6153 (diff)
Fix C++ exception throw warnings
-rw-r--r--ChangeLog3
-rw-r--r--implement.h14
-rw-r--r--ptw32_throw.c11
-rw-r--r--tests/once3.c4
4 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 25efebe..ae308b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
* ptw32_threadStart.c (ptw32_threadStart): Routine no longer attempts
to pass [unexpected C++] exceptions out of scope but ends the thread
normally setting EINTR as the exit status.
+ * ptw32_throw.c: Fix C++ exception throwing warnings; ignore
+ informational warning.
+ * implement.h: Likewise with the corresponding header definition.
2011-03-04 Ross Johnson <ross.johnson at homemail.com.au>
diff --git a/implement.h b/implement.h
index 807ae54..ef0943f 100644
--- a/implement.h
+++ b/implement.h
@@ -635,7 +635,19 @@ extern "C"
#endif
/* Declared in private.c */
- void ptw32_throw (DWORD exception);
+#ifdef _MSC_VER
+/*
+ * Ignore the warning:
+ * "C++ exception specification ignored except to indicate that
+ * the function is not __declspec(nothrow)."
+ */
+#pragma warning(disable:4290)
+#endif
+ void ptw32_throw (DWORD exception)
+#ifdef __CLEANUP_CXX
+ throw(ptw32_exception_cancel,ptw32_exception_exit)
+#endif
+;
#ifdef __cplusplus
}
diff --git a/ptw32_throw.c b/ptw32_throw.c
index 20068a7..cd8f874 100644
--- a/ptw32_throw.c
+++ b/ptw32_throw.c
@@ -46,8 +46,19 @@
* 'implicit' POSIX threads for each of the possible language modes (C,
* C++, and SEH).
*/
+#ifdef _MSC_VER
+/*
+ * Ignore the warning:
+ * "C++ exception specification ignored except to indicate that
+ * the function is not __declspec(nothrow)."
+ */
+#pragma warning(disable:4290)
+#endif
void
ptw32_throw (DWORD exception)
+#ifdef __CLEANUP_CXX
+ throw(ptw32_exception_cancel,ptw32_exception_exit)
+#endif
{
/*
* Don't use pthread_self() to avoid creating an implicit POSIX thread handle
diff --git a/tests/once3.c b/tests/once3.c
index e1886c1..00fa421 100644
--- a/tests/once3.c
+++ b/tests/once3.c
@@ -52,8 +52,8 @@
#define NUM_THREADS 100 /* Targeting each once control */
#define NUM_ONCE 10
-pthread_once_t o = PTHREAD_ONCE_INIT;
-pthread_once_t once[NUM_ONCE];
+static pthread_once_t o = PTHREAD_ONCE_INIT;
+static pthread_once_t once[NUM_ONCE];
typedef struct {
int i;