From a9bd9ec0b82c1e836535de55676e47d329a260f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 29 Apr 2024 21:51:14 +0000 Subject: Make tkWinTest.c warning-free, when compiled with Tcl 8.7 headers --- win/tkWinTest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win/tkWinTest.c b/win/tkWinTest.c index d4639d6..ae29eb6 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -17,6 +17,8 @@ #undef USE_TK_STUBS #define USE_TK_STUBS #include "tkWinInt.h" +#undef TCLBOOLWARNING +#define TCLBOOLWARNING(boolPtr) /* needed here because we compile with -Wc++-compat */ HWND tkWinCurrentDialog; -- cgit v0.12 From 682a2025a8557d37fdc00b7644af58ccb725543c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 30 Apr 2024 09:52:44 +0000 Subject: Simplify TkCygwinMainEx (int -> void return). Fix --disable-shared build on Windows (broken by previous commit) --- generic/tkMain.c | 7 ++----- generic/tkWindow.c | 22 +++++++++------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/generic/tkMain.c b/generic/tkMain.c index ab44c77..9268e93 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -17,7 +17,7 @@ #include "tkInt.h" #if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD) -MODULE_SCOPE int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); +MODULE_SCOPE void TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); #endif /* @@ -197,10 +197,7 @@ Tk_MainEx( * Tk_MainEx function of libtk8.?.dll, not this one. */ if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) { loadCygwinTk: - if (TkCygwinMainEx(argc, argv, appInitProc, interp)) { - /* Should never reach here. */ - return; - } + TkCygwinMainEx(argc, argv, appInitProc, interp); } else { int i; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index ccc62bc..5d664b9 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -2940,7 +2940,7 @@ static HMODULE tkcygwindll = NULL; * encoding conversions. */ -MODULE_SCOPE int +MODULE_SCOPE void TkCygwinMainEx( int argc, /* Number of arguments. */ char **argv, /* Array of argument strings. */ @@ -2962,17 +2962,13 @@ TkCygwinMainEx( memcpy(name+len-8, L"libtk8", 6 * sizeof(WCHAR)); tkcygwindll = LoadLibraryW(name); - if (!tkcygwindll) { - /* dll is not present */ - return 0; - } - tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *)) - (void *)GetProcAddress(tkcygwindll, "Tk_MainEx"); - if (!tkmainex) { - return 0; + if (tkcygwindll) { + tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *)) + (void *)GetProcAddress(tkcygwindll, "Tk_MainEx"); + if (tkmainex) { + tkmainex(argc, argv, appInitProc, interp); + } } - tkmainex(argc, argv, appInitProc, interp); - return 1; } #endif /* _WIN32 */ @@ -3003,7 +2999,7 @@ int Tk_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { -#if defined(_WIN32) +#if defined(_WIN32) && !defined(STATIC_BUILD) if (tkcygwindll) { int (*tkinit)(Tcl_Interp *); @@ -3076,7 +3072,7 @@ Tk_SafeInit( * checked at several places to differentiate the two initialisations. */ -#if defined(_WIN32) +#if defined(_WIN32) && !defined(STATIC_BUILD) if (tkcygwindll) { int (*tksafeinit)(Tcl_Interp *); -- cgit v0.12