]> granicus.if.org Git - python/commitdiff
Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy.
authorRichard Oudkerk <shibturn@gmail.com>
Tue, 1 Jan 2013 17:25:09 +0000 (17:25 +0000)
committerRichard Oudkerk <shibturn@gmail.com>
Tue, 1 Jan 2013 17:25:09 +0000 (17:25 +0000)
Misc/NEWS
Modules/_multiprocessing/semaphore.c

index 8bfa5690176c59e36931e09c0f4403902ac691f0..ff91c7157efd07c46e20a6afb56668aa727a26d9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -175,6 +175,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy.
+
 - Issue 10527: make multiprocessing use poll() instead of select() if available.
 
 - Issue #16485: Fix file descriptor not being closed if file header patching
index 5bda1ce12a03a0bc7a44252681f2f738c00512af..b9e8f345fbb1cd70918fb960377dadaea46fd8f3 100644 (file)
@@ -197,6 +197,13 @@ semlock_release(SemLockObject *self, PyObject *args)
 #define SEM_GETVALUE(sem, pval) sem_getvalue(sem, pval)
 #define SEM_UNLINK(name) sem_unlink(name)
 
+/* OS X 10.4 defines SEM_FAILED as -1 instead of (sem_t *)-1;  this gives
+   compiler warnings, and (potentially) undefined behaviour. */
+#ifdef __APPLE__
+#  undef SEM_FAILED
+#  define SEM_FAILED ((sem_t *)-1)
+#endif
+
 #ifndef HAVE_SEM_UNLINK
 #  define sem_unlink(name) 0
 #endif