]> 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:29:44 +0000 (17:29 +0000)
committerRichard Oudkerk <shibturn@gmail.com>
Tue, 1 Jan 2013 17:29:44 +0000 (17:29 +0000)
Misc/NEWS
Modules/_multiprocessing/semaphore.c

index 9e04951694017af86b4073a3f6780e73cfef30b4..a7e25344a99d19b7ace4a488c936f8d5a4bddd70 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -189,6 +189,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 1f37d6ac37756f078b95ea667c92f5a64b90f871..1ee224d550602b20d5f2a6db1c8044c401bcc9fd 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