diff options
| -rw-r--r-- | generic/tclDisassemble.c | 2 | ||||
| -rw-r--r-- | generic/tclInt.h | 8 | ||||
| -rw-r--r-- | generic/tclScan.c | 3 | ||||
| -rw-r--r-- | generic/tclTest.c | 4 | ||||
| -rw-r--r-- | macosx/tclMacOSXNotify.c | 101 |
5 files changed, 95 insertions, 23 deletions
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index b2465f3..f679862 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -1609,7 +1609,7 @@ Tcl_DisassembleObjCmd( "BYTECODE", NULL); return TCL_ERROR; } - if (PTR2INT(clientData)) { + if (clientData) { Tcl_SetObjResult(interp, DisassembleByteCodeAsDicts(interp, codeObjPtr)); } else { diff --git a/generic/tclInt.h b/generic/tclInt.h index b1014f6..f4750ec 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -105,19 +105,19 @@ typedef int ptrdiff_t; #if !defined(INT2PTR) && !defined(PTR2INT) # if defined(HAVE_INTPTR_T) || defined(intptr_t) # define INT2PTR(p) ((void *)(intptr_t)(p)) -# define PTR2INT(p) ((int)(intptr_t)(p)) +# define PTR2INT(p) ((intptr_t)(p)) # else # define INT2PTR(p) ((void *)(p)) -# define PTR2INT(p) ((int)(p)) +# define PTR2INT(p) ((long)(p)) # endif #endif #if !defined(UINT2PTR) && !defined(PTR2UINT) # if defined(HAVE_UINTPTR_T) || defined(uintptr_t) # define UINT2PTR(p) ((void *)(uintptr_t)(p)) -# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p)) +# define PTR2UINT(p) ((uintptr_t)(p)) # else # define UINT2PTR(p) ((void *)(p)) -# define PTR2UINT(p) ((unsigned int)(p)) +# define PTR2UINT(p) ((unsigned long)(p)) # endif #endif diff --git a/generic/tclScan.c b/generic/tclScan.c index 5e2c75a..faafabd 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -932,8 +932,7 @@ Tcl_ScanObjCmd( } } if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) { - sprintf(buf, "%" TCL_LL_MODIFIER "u", - (Tcl_WideUInt)wideValue); + sprintf(buf, "%" TCL_LL_MODIFIER "u", wideValue); Tcl_SetStringObj(objPtr, buf, -1); } else { TclSetIntObj(objPtr, wideValue); diff --git a/generic/tclTest.c b/generic/tclTest.c index 14228d0..615ff48 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -2395,7 +2395,7 @@ ExitProcOdd( char buf[16 + TCL_INTEGER_SPACE]; size_t len; - sprintf(buf, "odd %d\n", PTR2INT(clientData)); + sprintf(buf, "odd %" TCL_Z_MODIFIER "d\n", (size_t)PTR2INT(clientData)); len = strlen(buf); if (len != (size_t) write(1, buf, len)) { Tcl_Panic("ExitProcOdd: unable to write to stdout"); @@ -2409,7 +2409,7 @@ ExitProcEven( char buf[16 + TCL_INTEGER_SPACE]; size_t len; - sprintf(buf, "even %d\n", PTR2INT(clientData)); + sprintf(buf, "even %" TCL_Z_MODIFIER "d\n", (size_t)PTR2INT(clientData)); len = strlen(buf); if (len != (size_t) write(1, buf, len)) { Tcl_Panic("ExitProcEven: unable to write to stdout"); diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index cf78aba..aa00475 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -31,6 +31,9 @@ */ #if defined(HAVE_LIBKERN_OSATOMIC_H) && defined(HAVE_OSSPINLOCKLOCK) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#pragma GCC diagnostic ignored "-Wunused-function" /* * Use OSSpinLock API where available (Tiger or later). */ @@ -42,14 +45,17 @@ * Support for weakly importing spinlock API. */ #define WEAK_IMPORT_SPINLOCKLOCK + #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 #define VOLATILE volatile #else #define VOLATILE #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ + #ifndef bool #define bool int #endif + extern void OSSpinLockLock(VOLATILE OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; extern void OSSpinLockUnlock(VOLATILE OSSpinLock *lock) @@ -77,13 +83,54 @@ SpinLockLockInit(void) Tcl_Panic("SpinLockLockInit: no spinlock API available"); } } -#define SpinLockLock(p) lockLock(p) -#define SpinLockUnlock(p) lockUnlock(p) -#define SpinLockTry(p) lockTry(p) -#else -#define SpinLockLock(p) OSSpinLockLock(p) -#define SpinLockUnlock(p) OSSpinLockUnlock(p) -#define SpinLockTry(p) OSSpinLockTry(p) + +/* + * Wrappers so that we get warnings in just one small part of this file. + */ + +static inline void +SpinLockLock( + VOLATILE OSSpinLock *lock) +{ + lockLock(lock); +} +static inline void +SpinLockUnlock( + VOLATILE OSSpinLock *lock) +{ + lockUnlock(lock); +} +static inline bool +SpinLockTry( + VOLATILE OSSpinLock *lock) +{ + return lockTry(lock); +} + +#else /* !HAVE_WEAK_IMPORT */ + +/* + * Wrappers so that we get warnings in just one small part of this file. + */ + +static inline void +SpinLockLock( + OSSpinLock *lock) +{ + OSSpinLockLock(lock); +} +static inline void +SpinLockUnlock( + OSSpinLock *lock) +{ + OSSpinLockUnlock(lock); +} +static inline bool +SpinLockTry( + OSSpinLock *lock) +{ + return OSSpinLockTry(lock); +} #endif /* HAVE_WEAK_IMPORT */ #define SPINLOCK_INIT OS_SPINLOCK_INIT @@ -93,14 +140,37 @@ SpinLockLockInit(void) */ typedef uint32_t OSSpinLock; -extern void _spin_lock(OSSpinLock *lock); -extern void _spin_unlock(OSSpinLock *lock); -extern int _spin_lock_try(OSSpinLock *lock); -#define SpinLockLock(p) _spin_lock(p) -#define SpinLockUnlock(p) _spin_unlock(p) -#define SpinLockTry(p) _spin_lock_try(p) + +static inline void +SpinLockLock( + OSSpinLock *lock) +{ + extern void _spin_lock(OSSpinLock *lock); + + _spin_lock(lock); +} + +static inline void +SpinLockUnlock( + OSSpinLock *lock) +{ + extern void _spin_unlock(OSSpinLock *lock); + + _spin_unlock(lock); +} + +static inline int +SpinLockTry( + OSSpinLock *lock) +{ + extern int _spin_lock_try(OSSpinLock *lock); + + return _spin_lock_try(lock); +} + #define SPINLOCK_INIT 0 +#pragma GCC diagnostic pop #endif /* HAVE_LIBKERN_OSATOMIC_H && HAVE_OSSPINLOCKLOCK */ /* @@ -1411,7 +1481,10 @@ UpdateWaitingListAndServiceEvents( (tsdPtr->runLoopNestingLevel > 1 || !tsdPtr->runLoopRunning)) { tsdPtr->runLoopServicingEvents = 1; - /* This call seems to simply force event processing through and prevents hangups that have long been observed with Tk-Cocoa. */ + /* + * This call seems to simply force event processing through and + * prevents hangups that have long been observed with Tk-Cocoa. + */ Tcl_ServiceAll(); tsdPtr->runLoopServicingEvents = 0; } |
