Add isnanf module.
[pspp] / lib / tls.h
index fc1d8769ee5a4716836936711d4256ab0e3daea6..9b195063d1678cc0d820de455a293024d14efed9 100644 (file)
--- a/lib/tls.h
+++ b/lib/tls.h
@@ -1,5 +1,5 @@
 /* Thread-local storage in multithreaded situations.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -119,8 +119,12 @@ typedef union
       }                                                           \
     while (0)
 # define gl_tls_key_destroy(NAME) \
-    if (pthread_in_use () && pthread_key_delete ((NAME).key) != 0) \
-      abort ()
+    do                                                                 \
+      {                                                                \
+        if (pthread_in_use () && pthread_key_delete ((NAME).key) != 0) \
+          abort ();                                                    \
+      }                                                                \
+    while (0)
 
 #endif
 
@@ -188,8 +192,12 @@ typedef union
       }                                                   \
     while (0)
 # define gl_tls_key_destroy(NAME) \
-    if (pth_in_use () && !pth_key_delete ((NAME).key)) \
-      abort ()
+    do                                                     \
+      {                                                    \
+        if (pth_in_use () && !pth_key_delete ((NAME).key)) \
+          abort ();                                        \
+      }                                                    \
+    while (0)
 
 #endif
 
@@ -273,16 +281,29 @@ extern void *glthread_tls_get (thread_key_t key);
 typedef DWORD gl_tls_key_t;
 # define gl_tls_key_init(NAME, DESTRUCTOR) \
     /* The destructor is unsupported.  */    \
-    if (((NAME) = TlsAlloc ()) == (DWORD)-1) \
-      abort ()
+    do                                           \
+      {                                          \
+        if (((NAME) = TlsAlloc ()) == (DWORD)-1) \
+          abort ();                              \
+        (void) (DESTRUCTOR);                     \
+      }                                          \
+    while (0)
 # define gl_tls_get(NAME) \
     TlsGetValue (NAME)
 # define gl_tls_set(NAME, POINTER) \
-    if (!TlsSetValue (NAME, POINTER)) \
-      abort ()
+    do                                    \
+      {                                   \
+        if (!TlsSetValue (NAME, POINTER)) \
+          abort ();                       \
+      }                                   \
+    while (0)
 # define gl_tls_key_destroy(NAME) \
-    if (!TlsFree (NAME)) \
-      abort ()
+    do                       \
+      {                      \
+        if (!TlsFree (NAME)) \
+          abort ();          \
+      }                      \
+    while (0)
 
 #endif
 
@@ -300,7 +321,8 @@ typedef struct
         }
         gl_tls_key_t;
 # define gl_tls_key_init(NAME, DESTRUCTOR) \
-    (NAME).singlethread_value = NULL
+    ((NAME).singlethread_value = NULL, \
+     (void) (DESTRUCTOR))
 # define gl_tls_get(NAME) \
     (NAME).singlethread_value
 # define gl_tls_set(NAME, POINTER) \