summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-06-28 15:13:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-06-28 15:13:31 (GMT)
commit2c7d6403e8bf45a9d610dd24471c79ffc0efb10f (patch)
tree991d5c45b647447f7bc568717d77835ef9fd559d
parent06f1954e8d128d267854ef360ea341f849ca43cf (diff)
downloadtcl-2c7d6403e8bf45a9d610dd24471c79ffc0efb10f.zip
tcl-2c7d6403e8bf45a9d610dd24471c79ffc0efb10f.tar.gz
tcl-2c7d6403e8bf45a9d610dd24471c79ffc0efb10f.tar.bz2
MacOSX: add some type-casts, improving C++ compatibility. Make sure that strstr and strtoul() are not configured as invalid: Mac is more strict in exact function signatures. Backported from 8.7
-rw-r--r--macosx/tclMacOSXBundle.c2
-rw-r--r--macosx/tclMacOSXFCmd.c8
-rw-r--r--macosx/tclMacOSXNotify.c28
-rwxr-xr-xunix/configure2
-rw-r--r--unix/configure.in2
5 files changed, 24 insertions, 18 deletions
diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c
index 9fadb7b..beef2ed 100644
--- a/macosx/tclMacOSXBundle.c
+++ b/macosx/tclMacOSXBundle.c
@@ -106,7 +106,7 @@ OpenResourceMap(
if (tclMacOSXDarwinRelease >= 8)
#endif
{
- openresourcemap = dlsym(RTLD_NEXT,
+ openresourcemap = (short (*)(CFBundleRef))dlsym(RTLD_NEXT,
"CFBundleOpenBundleResourceMap");
#ifdef TCL_DEBUG_LOAD
if (!openresourcemap) {
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index f34b280..e462e5e 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.c
@@ -106,7 +106,7 @@ typedef struct finderinfo {
u_int32_t extendedFileInfo[4];
} __attribute__ ((__packed__)) finderinfo;
-typedef struct fileinfobuf {
+typedef struct {
u_int32_t info_length;
u_int32_t data[8];
} fileinfobuf;
@@ -172,7 +172,7 @@ TclMacOSXGetFileAttribute(
} else {
alist.commonattr = ATTR_CMN_FNDRINFO;
}
- native = Tcl_FSGetNativePath(fileName);
+ native = (const char *)Tcl_FSGetNativePath(fileName);
result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);
if (result != 0) {
@@ -268,7 +268,7 @@ TclMacOSXSetFileAttribute(
} else {
alist.commonattr = ATTR_CMN_FNDRINFO;
}
- native = Tcl_FSGetNativePath(fileName);
+ native = (const char *)Tcl_FSGetNativePath(fileName);
result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);
if (result != 0) {
@@ -347,7 +347,7 @@ TclMacOSXSetFileAttribute(
Tcl_DStringAppend(&ds, native, -1);
Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1);
- result = truncate(Tcl_DStringValue(&ds), (off_t)0);
+ result = truncate(Tcl_DStringValue(&ds), 0);
if (result != 0) {
/*
* truncate() on a valid resource fork path may fail with a
diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c
index 9b7bd1a..01581cf 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)
@@ -101,6 +107,7 @@ extern int _spin_lock_try(OSSpinLock *lock);
#define SpinLockTry(p) _spin_lock_try(p)
#define SPINLOCK_INIT 0
+#pragma GCC diagnostic pop
#endif /* HAVE_LIBKERN_OSATOMIC_H && HAVE_OSSPINLOCKLOCK */
/*
@@ -217,7 +224,7 @@ typedef struct FileHandler {
* handlers are ready to fire.
*/
-typedef struct FileHandlerEvent {
+typedef struct {
Tcl_Event header; /* Information that is standard for all
* events. */
int fd; /* File descriptor that is ready. Used to find
@@ -232,7 +239,7 @@ typedef struct FileHandlerEvent {
* writable, and exceptional conditions.
*/
-typedef struct SelectMasks {
+typedef struct {
fd_set readable;
fd_set writable;
fd_set exceptional;
@@ -686,7 +693,7 @@ StartNotifierThread(void)
void
Tcl_FinalizeNotifier(
- ClientData clientData) /* Not used. */
+ ClientData clientData)
{
ThreadSpecificData *tsdPtr;
@@ -789,7 +796,7 @@ void
Tcl_AlertNotifier(
ClientData clientData)
{
- ThreadSpecificData *tsdPtr = clientData;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)clientData;
if (tclNotifierHooks.alertNotifierProc) {
tclNotifierHooks.alertNotifierProc(clientData);
@@ -967,7 +974,7 @@ Tcl_CreateFileHandler(
}
}
if (filePtr == NULL) {
- filePtr = ckalloc(sizeof(FileHandler));
+ filePtr = (FileHandler *)ckalloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
@@ -1311,7 +1318,7 @@ QueueFileEvents(
{
SelectMasks readyMasks;
FileHandler *filePtr;
- ThreadSpecificData *tsdPtr = info;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info;
/*
* Queue all detected file events.
@@ -1350,7 +1357,7 @@ QueueFileEvents(
*/
if (filePtr->readyMask == 0) {
- FileHandlerEvent *fileEvPtr = ckalloc(sizeof(FileHandlerEvent));
+ FileHandlerEvent *fileEvPtr = (FileHandlerEvent *)ckalloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
@@ -1383,7 +1390,7 @@ UpdateWaitingListAndServiceEvents(
CFRunLoopActivity activity,
void *info)
{
- ThreadSpecificData *tsdPtr = info;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info;
if (tsdPtr->sleeping) {
return;
@@ -1412,7 +1419,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;
}
diff --git a/unix/configure b/unix/configure
index 73a8eac..7d40237 100755
--- a/unix/configure
+++ b/unix/configure
@@ -14926,7 +14926,6 @@ cat >>conftest.$ac_ext <<_ACEOF
#include <stdlib.h>
#include <string.h>
int main() {
- extern int strstr();
exit(strstr("\0test", "test") ? 1 : 0);
}
_ACEOF
@@ -15096,7 +15095,6 @@ cat >>conftest.$ac_ext <<_ACEOF
#include <stdlib.h>
#include <string.h>
int main() {
- extern int strtoul();
char *term, *string = "0";
exit(strtoul(string,&term,0) != 0 || term != string+1);
}
diff --git a/unix/configure.in b/unix/configure.in
index 9dd9b7f..2a66cb1 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -342,7 +342,6 @@ AC_CHECK_FUNC(memmove, , [
#--------------------------------------------------------------------
SC_TCL_CHECK_BROKEN_FUNC(strstr, [
- extern int strstr();
exit(strstr("\0test", "test") ? 1 : 0);
])
@@ -353,7 +352,6 @@ SC_TCL_CHECK_BROKEN_FUNC(strstr, [
#--------------------------------------------------------------------
SC_TCL_CHECK_BROKEN_FUNC(strtoul, [
- extern int strtoul();
char *term, *string = "0";
exit(strtoul(string,&term,0) != 0 || term != string+1);
])