summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-08-23 13:00:47 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-08-23 13:00:47 (GMT)
commita5048e8dd92669687e9e6a3e5e040477366a5b69 (patch)
tree14fc254a3b62a1b608d07608c6b3aab3fe073d5a
parent94b338844e5af1659858a5446714c65fcbaecf54 (diff)
parenta5448b6c8bdb4aeac833b411b94637047889cbd8 (diff)
downloadtcl-a5048e8dd92669687e9e6a3e5e040477366a5b69.zip
tcl-a5048e8dd92669687e9e6a3e5e040477366a5b69.tar.gz
tcl-a5048e8dd92669687e9e6a3e5e040477366a5b69.tar.bz2
Make everything compile warning-free when TCL_THREADS=0
-rw-r--r--generic/tclAsync.c2
-rw-r--r--generic/tclEvent.c6
-rw-r--r--generic/tclIORChan.c2
-rw-r--r--generic/tclIORTrans.c2
-rw-r--r--generic/tclTest.c11
-rw-r--r--generic/tclThread.c14
-rw-r--r--tests/async.test7
-rw-r--r--unix/tclEpollNotfy.c6
-rw-r--r--unix/tclKqueueNotfy.c6
-rw-r--r--unix/tclSelectNotfy.c12
-rw-r--r--unix/tclUnixFile.c4
-rw-r--r--unix/tclUnixNotfy.c4
-rw-r--r--unix/tclUnixThrd.c8
-rw-r--r--win/tclWinLoad.c2
-rw-r--r--win/tclWinNotify.c10
15 files changed, 65 insertions, 31 deletions
diff --git a/generic/tclAsync.c b/generic/tclAsync.c
index c790822..9ce2c88 100644
--- a/generic/tclAsync.c
+++ b/generic/tclAsync.c
@@ -233,6 +233,8 @@ Tcl_AsyncMarkFromSignal(
return TclAsyncNotifier(sigNumber, token->originThrdId,
token->notifierData, &token->ready, -1);
#else
+ (void)sigNumber;
+
Tcl_AsyncMark(async);
return 1;
#endif
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 52cd351..cb2e529 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -1618,6 +1618,12 @@ Tcl_CreateThread(
}
return result;
#else
+ (void)idPtr;
+ (void)proc;
+ (void)clientData;
+ (void)stackSize;
+ (void)flags;
+
return TCL_ERROR;
#endif /* TCL_THREADS */
}
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index cc45873..fe383be 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -2766,6 +2766,8 @@ DeleteReflectedChannelMap(
MarkDead(rcPtr);
Tcl_DeleteHashEntry(hPtr);
}
+#else
+ (void)interp;
#endif
}
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index b06bd45..7dba42d 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -2158,6 +2158,8 @@ DeleteReflectedTransformMap(
ForwardingResult *resultPtr;
ForwardingEvent *evPtr;
ForwardParam *paramPtr;
+#else
+ (void)interp;
#endif /* TCL_THREADS */
/*
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 99fe92f..5c08aa0 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -163,9 +163,7 @@ static TestChannel *firstDetached;
static int AsyncHandlerProc(void *clientData,
Tcl_Interp *interp, int code);
-#if TCL_THREADS
static Tcl_ThreadCreateType AsyncThreadProc(void *);
-#endif
static void CleanupTestSetassocdataTests(
void *clientData, Tcl_Interp *interp);
static void CmdDelProc1(void *clientData);
@@ -821,7 +819,6 @@ TestasyncCmd(
Tcl_SetObjResult(interp, Tcl_NewStringObj(argv[3], -1));
Tcl_MutexUnlock(&asyncTestMutex);
return code;
-#if TCL_THREADS
} else if (strcmp(argv[1], "marklater") == 0) {
if (argc != 3) {
goto wrongNumArgs;
@@ -849,12 +846,6 @@ TestasyncCmd(
Tcl_AppendResult(interp, "bad option \"", argv[1],
"\": must be create, delete, int, mark, or marklater", NULL);
return TCL_ERROR;
-#else /* !TCL_THREADS */
- } else {
- Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be create, delete, int, or mark", NULL);
- return TCL_ERROR;
-#endif
}
return TCL_OK;
}
@@ -920,7 +911,6 @@ AsyncHandlerProc(
*----------------------------------------------------------------------
*/
-#if TCL_THREADS
static Tcl_ThreadCreateType
AsyncThreadProc(
void *clientData) /* Parameter is the id of a
@@ -942,7 +932,6 @@ AsyncThreadProc(
Tcl_ExitThread(TCL_OK);
TCL_THREAD_CREATE_RETURN;
}
-#endif
static int
TestbumpinterpepochObjCmd(
diff --git a/generic/tclThread.c b/generic/tclThread.c
index 0e6e874..de9fac9 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.c
@@ -80,7 +80,7 @@ Tcl_GetThreadData(
if (*keyPtr == NULL) {
result = ckalloc(size);
memset(result, 0, size);
- *keyPtr = result;
+ *keyPtr = (Tcl_ThreadDataKey)result;
RememberSyncObject(keyPtr, &keyRecord);
} else {
result = *keyPtr;
@@ -488,30 +488,30 @@ Tcl_ExitThread(
#undef Tcl_ConditionWait
void
Tcl_ConditionWait(
- Tcl_Condition *condPtr, /* Really (pthread_cond_t **) */
- Tcl_Mutex *mutexPtr, /* Really (pthread_mutex_t **) */
- const Tcl_Time *timePtr) /* Timeout on waiting period */
+ TCL_UNUSED(Tcl_Condition *), /* Really (pthread_cond_t **) */
+ TCL_UNUSED(Tcl_Mutex *), /* Really (pthread_mutex_t **) */
+ TCL_UNUSED(const Tcl_Time *)) /* Timeout on waiting period */
{
}
#undef Tcl_ConditionNotify
void
Tcl_ConditionNotify(
- Tcl_Condition *condPtr)
+ TCL_UNUSED(Tcl_Condition *))
{
}
#undef Tcl_MutexLock
void
Tcl_MutexLock(
- Tcl_Mutex *mutexPtr)
+ TCL_UNUSED(Tcl_Mutex *))
{
}
#undef Tcl_MutexUnlock
void
Tcl_MutexUnlock(
- Tcl_Mutex *mutexPtr)
+ TCL_UNUSED(Tcl_Mutex *))
{
}
#endif /* !TCL_THREADS */
diff --git a/tests/async.test b/tests/async.test
index 0f0af0e..2d8f678 100644
--- a/tests/async.test
+++ b/tests/async.test
@@ -19,6 +19,7 @@ if {"::tcltest" ni [namespace children]} {
::tcltest::loadTestedCommands
catch [list package require -exact tcl::test [info patchlevel]]
+testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}]
testConstraint testasync [llength [info commands testasync]]
testConstraint knownMsvcBug [expr {![info exists ::env(CI_BUILD_WITH_MSVC)]}]
@@ -149,7 +150,7 @@ test async-3.1 {deleting handlers} testasync {
} {3 del2 {0 0 0 del1 del2}}
test async-4.1 {async interrupting bytecode sequence} -constraints {
- testasync
+ testasync thread
} -setup {
set hm [testasync create async3]
proc nothing {} {
@@ -178,7 +179,7 @@ test async-4.1 {async interrupting bytecode sequence} -constraints {
testasync delete $hm
}
test async-4.2 {async interrupting straight bytecode sequence} -constraints {
- testasync
+ testasync thread
} -setup {
set hm [testasync create async3]
} -body {
@@ -203,7 +204,7 @@ test async-4.2 {async interrupting straight bytecode sequence} -constraints {
testasync delete $hm
}
test async-4.3 {async interrupting loop-less bytecode sequence} -constraints {
- testasync knownMsvcBug
+ testasync thread knownMsvcBug
} -setup {
set hm [testasync create async3]
} -body {
diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c
index bab02ee..649c21b 100644
--- a/unix/tclEpollNotfy.c
+++ b/unix/tclEpollNotfy.c
@@ -820,6 +820,12 @@ TclAsyncNotifier(
*/
pthread_kill((pthread_t) threadId, sigNumber);
+#else
+ (void)sigNumber;
+ (void)threadId;
+ (void)clientData;
+ (void)flagPtr;
+ (void)value;
#endif
return 0;
}
diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c
index bc79ddf..2f495bd 100644
--- a/unix/tclKqueueNotfy.c
+++ b/unix/tclKqueueNotfy.c
@@ -816,6 +816,12 @@ TclAsyncNotifier(
*/
pthread_kill((pthread_t) threadId, sigNumber);
+#else
+ (void)sigNumber;
+ (void)threadId;
+ (void)clientData;
+ (void)flagPtr;
+ (void)value;
#endif
return 0;
}
diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c
index f7e61c9..732e4c9 100644
--- a/unix/tclSelectNotfy.c
+++ b/unix/tclSelectNotfy.c
@@ -203,7 +203,9 @@ static Tcl_ThreadId notifierThread;
*/
static sigset_t notifierSigMask;
+#ifndef HAVE_PSELECT
static sigset_t allSigMask;
+#endif /* HAVE_PSELECT */
#endif /* TCL_THREADS */
@@ -279,9 +281,11 @@ extern unsigned char __stdcall TranslateMessage(const MSG *);
* Threaded-cygwin specific constants and functions in this file:
*/
+#if TCL_THREADS && defined(__CYGWIN__)
static const wchar_t className[] = L"TclNotifier";
static unsigned int __stdcall NotifierProc(void *hwnd, unsigned int message,
void *wParam, void *lParam);
+#endif /* TCL_THREADS && defined(__CYGWIN__) */
#ifdef __cplusplus
}
#endif
@@ -594,7 +598,7 @@ TclpDeleteFileHandler(
ckfree(filePtr);
}
-#if defined(__CYGWIN__)
+#if TCL_THREADS && defined(__CYGWIN__)
static unsigned int __stdcall
NotifierProc(
@@ -916,7 +920,7 @@ TclpWaitForEvent(
int
TclAsyncNotifier(
int sigNumber, /* Signal number. */
- Tcl_ThreadId threadId, /* Target thread. */
+ TCL_UNUSED(Tcl_ThreadId), /* Target thread. */
TCL_UNUSED(ClientData), /* Notifier data. */
int *flagPtr, /* Flag to mark. */
int value) /* Value of mark. */
@@ -946,6 +950,10 @@ TclAsyncNotifier(
*/
pthread_kill((pthread_t) notifierThread, sigNumber);
+#else
+ (void)sigNumber;
+ (void)flagPtr;
+ (void)value;
#endif
return 0;
}
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 6cbdec9..998614d 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -41,10 +41,10 @@ TclpFindExecutable(
{
Tcl_Encoding encoding;
int length;
- wchar_t buf[PATH_MAX];
+ wchar_t buf[PATH_MAX] = L"";
char name[PATH_MAX * 3 + 1];
- GetModuleFileNameW(NULL, buf, sizeof(buf)/sizeof(wchar_t));
+ GetModuleFileNameW(NULL, buf, PATH_MAX);
cygwin_conv_path(3, buf, name, sizeof(name));
length = strlen(name);
if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) {
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index e7e70ef..943e7d7 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -105,7 +105,7 @@ StartNotifierThread(
void
TclpAlertNotifier(
- ClientData clientData)
+ void *clientData)
{
#ifdef NOTIFIER_SELECT
#if TCL_THREADS
@@ -120,6 +120,8 @@ TclpAlertNotifier(
pthread_cond_broadcast(&tsdPtr->waitCV);
# endif /* __CYGWIN__ */
pthread_mutex_unlock(&notifierMutex);
+#else
+ (void)clientData;
#endif /* TCL_THREADS */
#else /* !NOTIFIER_SELECT */
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 8a16d0b..aa5926e 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -277,6 +277,11 @@ TclpThreadCreate(
pthread_attr_destroy(&attr);
return result;
#else
+ (void)idPtr;
+ (void)proc;
+ (void)clientData;
+ (void)stackSize;
+ (void)flags;
return TCL_ERROR;
#endif /* TCL_THREADS */
}
@@ -314,6 +319,9 @@ Tcl_JoinThread(
}
return (result == 0) ? TCL_OK : TCL_ERROR;
#else
+ (void)threadId;
+ (void)state;
+
return TCL_ERROR;
#endif
}
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index 0f664f0..e262595 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.c
@@ -20,7 +20,9 @@
*/
static WCHAR *dllDirectoryName = NULL;
+#if TCL_THREADS
static Tcl_Mutex dllDirectoryNameMutex;
+#endif
/*
* Static functions defined within this file.
diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c
index f951acf..fd39428 100644
--- a/win/tclWinNotify.c
+++ b/win/tclWinNotify.c
@@ -367,11 +367,11 @@ TclpServiceModeHook(
int
TclAsyncNotifier(
- int sigNumber, /* Signal number. */
- Tcl_ThreadId threadId, /* Target thread. */
- ClientData clientData, /* Notifier data. */
- int *flagPtr, /* Flag to mark. */
- int value) /* Value of mark. */
+ TCL_UNUSED(int), /* Signal number. */
+ TCL_UNUSED(Tcl_ThreadId), /* Target thread. */
+ TCL_UNUSED(void *), /* Notifier data. */
+ TCL_UNUSED(int *), /* Flag to mark. */
+ TCL_UNUSED(int)) /* Value of mark. */
{
return 0;
}