diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 13:07:31 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 13:07:31 (GMT) |
commit | 47f1a8a08fa32a319b564eca0c1570cbcb78a6dc (patch) | |
tree | 3dec82f55a6f01e0b464044f554fb3335394e1b3 /win | |
parent | e119a87f5f576ce9c4469d5f0b2d648127c7531f (diff) | |
parent | e09be91bbab4de3be2f23c5ba57fbdd242942313 (diff) | |
download | tk-47f1a8a08fa32a319b564eca0c1570cbcb78a6dc.zip tk-47f1a8a08fa32a319b564eca0c1570cbcb78a6dc.tar.gz tk-47f1a8a08fa32a319b564eca0c1570cbcb78a6dc.tar.bz2 |
Merge 8.7
Diffstat (limited to 'win')
-rwxr-xr-x | win/configure | 28 | ||||
-rw-r--r-- | win/rules-ext.vc | 5 | ||||
-rw-r--r-- | win/rules.vc | 33 | ||||
-rw-r--r-- | win/targets.vc | 2 | ||||
-rw-r--r-- | win/tcl.m4 | 24 | ||||
-rw-r--r-- | win/tkWin32Dll.c | 6 | ||||
-rw-r--r-- | win/tkWinClipboard.c | 8 | ||||
-rw-r--r-- | win/tkWinColor.c | 24 | ||||
-rw-r--r-- | win/tkWinKey.c | 23 | ||||
-rwxr-xr-x | win/x86_64-w64-mingw32-nmakehlp.exe | bin | 0 -> 25088 bytes |
10 files changed, 97 insertions, 56 deletions
diff --git a/win/configure b/win/configure index a2eb11f..cbb5195 100755 --- a/win/configure +++ b/win/configure @@ -4168,7 +4168,7 @@ fi SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, - # which requires x86|amd64|ia64. + # which requires x86|amd64|arm64|ia64. MACHINE="X86" if test "$GCC" = "yes"; then @@ -4215,6 +4215,13 @@ printf "%s\n" "$ac_cv_cross" >&6; } RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; + arm64|aarch64) + CC="aarch64-w64-mingw32-clang" + LD="aarch64-w64-mingw32-ld" + AR="aarch64-w64-mingw32-ar" + RANLIB="aarch64-w64-mingw32-ranlib" + RC="aarch64-w64-mingw32-windres" + ;; *) CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" @@ -4305,6 +4312,9 @@ printf "%s\n" "$ac_cv_win32" >&6; } if test "$ac_cv_win32" != "yes"; then as_fn_error $? "${CC} cannot produce win32 executables." "$LINENO" 5 fi + if test "$do64bit" != "arm64"; then + extra_cflags="$extra_cflags -DHAVE_CPUID=1" + fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -municode linker flag" >&5 @@ -4597,10 +4607,15 @@ printf "%s\n" "using shared flags" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 printf "%s\n" " Using 64-bit $MACHINE mode" >&6; } ;; + arm64|aarch64) + MACHINE="ARM64" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using ARM64 $MACHINE mode" >&5 +printf "%s\n" " Using ARM64 $MACHINE mode" >&6; } + ;; ia64) MACHINE="IA64" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 -printf "%s\n" " Using 64-bit $MACHINE mode" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using IA64 $MACHINE mode" >&5 +printf "%s\n" " Using IA64 $MACHINE mode" >&6; } ;; *) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4670,6 +4685,9 @@ printf "%s\n" "using shared flags" >&6; } amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; + arm64|aarch64) + MACHINE="ARM64" + ;; ia64) MACHINE="IA64" ;; @@ -4691,8 +4709,7 @@ printf "%s\n" " Using 64-bit $MACHINE mode" >&6; } if test "$do64bit" != "no" ; then RC="rc" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" - # Do not use -O2 for Win64 - this has proved buggy in code gen. - CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}" + CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo -MACHINE:${MACHINE}" LINKBIN="link" # Avoid 'unresolved external symbol __security_cookie' errors. @@ -5991,7 +6008,6 @@ TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.` ac_config_files="$ac_config_files Makefile tkConfig.sh wish.exe.manifest" - cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 6da5689..6d31a03 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -31,8 +31,13 @@ macro to the name of the project makefile. # We extract version numbers using the nmakehlp program. For now use
# the local copy of nmakehlp. Once we locate Tcl, we will use that
# one if it is newer.
+!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
!if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul]
!endif
+!else
+!if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL]
+!endif
+!endif
# First locate the Tcl directory that we are working with.
!if "$(TCLDIR)" != ""
diff --git a/win/rules.vc b/win/rules.vc index c24fce3..372d70a 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -24,7 +24,7 @@ _RULES_VC = 1 # For modifications that are not backward-compatible, you *must* change
# the major version.
RULES_VERSION_MAJOR = 1
-RULES_VERSION_MINOR = 9
+RULES_VERSION_MINOR = 10
# The PROJECT macro must be defined by parent makefile.
!if "$(PROJECT)" == ""
@@ -411,8 +411,8 @@ _INSTALLDIR=$(_INSTALLDIR)\lib # compiler version 1200. This is kept only for legacy reasons as it
# does not make sense for recent Microsoft compilers. Only used for
# output directory names.
-# ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target
-# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
+# ARCH - set to IX86, ARM64 or AMD64 depending on 32- or 64-bit target
+# NATIVE_ARCH - set to IX86, ARM64 or AMD64 for the host machine
# MACHINE - same as $(ARCH) - legacy
# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
@@ -435,6 +435,8 @@ VCVER=0 && ![echo ARCH=IX86 >> vercl.x] \
&& ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
&& ![echo ARCH=AMD64 >> vercl.x] \
+ && ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \
+ && ![echo ARCH=ARM64 >> vercl.x] \
&& ![echo $(_HASH)endif >> vercl.x] \
&& ![$(cc32) -nologo -TC -P vercl.x 2>NUL]
!include vercl.i
@@ -459,6 +461,9 @@ VCVER = $(VCVERSION) !if "$(MACHINE)" == "x86"
!undef MACHINE
MACHINE = IX86
+!elseif "$(MACHINE)" == "arm64"
+!undef MACHINE
+MACHINE = ARM64
!elseif "$(MACHINE)" == "x64"
!undef MACHINE
MACHINE = AMD64
@@ -475,6 +480,8 @@ MACHINE=$(ARCH) # the Tcl platform::identify command
!if "$(MACHINE)" == "AMD64"
PLATFORM_IDENTIFY = win32-x86_64
+!elseif "$(MACHINE)" == "ARM64"
+PLATFORM_IDENTIFY = win32-arm
!else
PLATFORM_IDENTIFY = win32-ix86
!endif
@@ -490,6 +497,8 @@ MULTIPLATFORM_INSTALL = 0 !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
NATIVE_ARCH=IX86
+!elseif ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i ARM | findstr /i 64-bit]
+NATIVE_ARCH=ARM64
!else
NATIVE_ARCH=AMD64
!endif
@@ -541,8 +550,13 @@ NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c # We always build nmakehlp even if it exists since we do not know
# what source it was built from.
+!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
!endif
+!else
+!if [copy $(NMAKEHLPC:nmakehlp.c=x86_64-w64-mingw32-nmakehlp.exe) nmakehlp.exe >NUL]
+!endif
+!endif
################################################################
# 5. Test for compiler features
@@ -1344,7 +1358,7 @@ INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include # baselibs - minimum Windows libraries required. Parent makefile can
# define PRJ_LIBS before including rules.rc if additional libs are needed
-OPTDEFINES = /DSTDC_HEADERS
+OPTDEFINES = /DSTDC_HEADERS /DUSE_NMAKE=1
!if $(VCVERSION) > 1600
OPTDEFINES = $(OPTDEFINES) /DHAVE_STDINT_H=1
!else
@@ -1370,7 +1384,7 @@ OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1 OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD
!elseif $(TCL_VERSION) > 86
OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH
-!if "$(MACHINE)" == "AMD64"
+!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64"
OPTDEFINES = $(OPTDEFINES) /DMP_64BIT
!endif
!endif
@@ -1398,7 +1412,7 @@ OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_OPTIMIZED !if $(PROFILE)
OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_PROFILED
!endif
-!if "$(MACHINE)" == "AMD64"
+!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64"
OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_DO64BIT
!endif
!if $(VCVERSION) < 1300
@@ -1460,7 +1474,7 @@ cdebug = $(cdebug) -Zi # cwarn includes default warning levels.
cwarn = $(WARNINGS)
-!if "$(MACHINE)" == "AMD64"
+!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64"
# Disable pointer<->int warnings related to cast between different sizes
# There are a gadzillion of these due to use of ClientData and
# clutter up compiler
@@ -1476,6 +1490,11 @@ carch = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE carch =
!endif
+# cpuid is only available on intel machines
+!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "AMD64"
+carch = $(carch) /DHAVE_CPUID=1
+!endif
+
!if $(DEBUG)
# Turn warnings into errors
cwarn = $(cwarn) -WX
diff --git a/win/targets.vc b/win/targets.vc index 6bfebc7..077e8f7 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -4,7 +4,7 @@ # Part of the nmake based build system for Tcl and its extensions.
# This file defines some standard targets for the convenience of extensions
# and can be optionally included by the extension makefile.
-# See TIP 477 (https://core.tcl-lang.org/tips/doc/trunk/tip/477.md) for docs.
+# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for docs.
$(PROJECT): setup pkgindex $(PRJLIB)
@@ -501,7 +501,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, - # which requires x86|amd64|ia64. + # which requires x86|amd64|arm64|ia64. MACHINE="X86" if test "$GCC" = "yes"; then @@ -526,6 +526,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; + arm64|aarch64) + CC="aarch64-w64-mingw32-clang" + LD="aarch64-w64-mingw32-ld" + AR="aarch64-w64-mingw32-ar" + RANLIB="aarch64-w64-mingw32-ranlib" + RC="aarch64-w64-mingw32-windres" + ;; *) CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" @@ -586,6 +593,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$ac_cv_win32" != "yes"; then AC_MSG_ERROR([${CC} cannot produce win32 executables.]) fi + if test "$do64bit" != "arm64"; then + extra_cflags="$extra_cflags -DHAVE_CPUID=1" + fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain" AC_CACHE_CHECK(for working -municode linker flag, @@ -735,9 +745,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ MACHINE="AMD64" ; # assume AMD64 as default 64-bit build AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) ;; + arm64|aarch64) + MACHINE="ARM64" + AC_MSG_RESULT([ Using ARM64 $MACHINE mode]) + ;; ia64) MACHINE="IA64" - AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) + AC_MSG_RESULT([ Using IA64 $MACHINE mode]) ;; *) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -789,6 +803,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build ;; + arm64|aarch64) + MACHINE="ARM64" + ;; ia64) MACHINE="IA64" ;; @@ -809,8 +826,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$do64bit" != "no" ; then RC="rc" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" - # Do not use -O2 for Win64 - this has proved buggy in code gen. - CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}" + CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo -MACHINE:${MACHINE}" LINKBIN="link" # Avoid 'unresolved external symbol __security_cookie' errors. diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index 24507bb..1e4bf1b 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -101,7 +101,7 @@ DllMain( DWORD reason, LPVOID reserved) { -#ifdef HAVE_NO_SEH +#if defined(HAVE_NO_SEH) && !defined(__aarch64__) TCLEXCEPTION_REGISTRATION registration; #endif (void)reserved; @@ -124,7 +124,9 @@ DllMain( */ #ifdef HAVE_NO_SEH -# ifdef _WIN64 +# if defined(__aarch64__) + /* Don't run TkFinalize(NULL) on mingw-w64 for ARM64, since we don't have corresponding assembler-code. */ +# elif defined(_WIN64) __asm__ __volatile__ ( /* diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 61c6b36..2f54ff6 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -55,16 +55,16 @@ TkSelGetSelection( Tcl_Encoding encoding; int result, locale, noBackslash = 0; + if ((selection != Tk_InternAtom(tkwin, "CLIPBOARD")) + || (target != XA_STRING)) { + goto error; + } if (!OpenClipboard(NULL)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "clipboard cannot be opened, another application grabbed it")); Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL); return TCL_ERROR; } - if ((selection != Tk_InternAtom(tkwin, "CLIPBOARD")) - || (target != XA_STRING)) { - goto error; - } /* * Attempt to get the data in Unicode form if available as this is less diff --git a/win/tkWinColor.c b/win/tkWinColor.c index d4a0d59..aa5c12b 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -301,14 +301,13 @@ TkWinIndexOfColor( int XAllocColor( - Display *display, + TCL_UNUSED(Display *), Colormap colormap, XColor *color) { TkWinColormap *cmap = (TkWinColormap *) colormap; PALETTEENTRY entry, closeEntry; HDC dc = GetDC(NULL); - (void)display; entry.peRed = (color->red) >> 8; entry.peGreen = (color->green) >> 8; @@ -402,11 +401,11 @@ XAllocColor( int XFreeColors( - Display *display, + TCL_UNUSED(Display *), Colormap colormap, unsigned long *pixels, int npixels, - unsigned long planes) + TCL_UNUSED(unsigned long)) { TkWinColormap *cmap = (TkWinColormap *) colormap; COLORREF cref; @@ -416,8 +415,6 @@ XFreeColors( PALETTEENTRY entry, *entries; Tcl_HashEntry *entryPtr; HDC dc = GetDC(NULL); - (void)display; - (void)planes; /* * We don't have to do anything for non-palette devices. @@ -476,10 +473,10 @@ XFreeColors( Colormap XCreateColormap( - Display *display, - Window w, - Visual *visual, - int alloc) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Visual *), + TCL_UNUSED(int)) { char logPalBuf[sizeof(LOGPALETTE) + 256 * sizeof(PALETTEENTRY)]; LOGPALETTE *logPalettePtr; @@ -489,10 +486,6 @@ XCreateColormap( int isNew; UINT i; HPALETTE sysPal; - (void)display; - (void)w; - (void)visual; - (void)alloc; /* * Allocate a starting palette with all of the reserved colors. @@ -543,11 +536,10 @@ XCreateColormap( int XFreeColormap( - Display *display, + TCL_UNUSED(Display *), Colormap colormap) { TkWinColormap *cmap = (TkWinColormap *) colormap; - (void)display; if (!DeleteObject(cmap->palette)) { Tcl_Panic("Unable to free colormap, palette is still selected"); diff --git a/win/tkWinKey.c b/win/tkWinKey.c index 1183eaa..9aca1f2 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -90,7 +90,7 @@ static KeySym KeycodeToKeysym(unsigned int keycode, const char * TkpGetString( - TkWindow *winPtr, /* Window where event occurred: needed to get + TCL_UNUSED(TkWindow *), /* Window where event occurred: needed to get * input context. */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold @@ -99,7 +99,6 @@ TkpGetString( XKeyEvent *keyEv = &eventPtr->xkey; int len; char buf[6]; - (void)winPtr; Tcl_DStringInit(dsPtr); if (keyEv->send_event == -1) { @@ -152,12 +151,11 @@ TkpGetString( KeySym XKeycodeToKeysym( - Display *display, + TCL_UNUSED(Display *), unsigned int keycode, int index) { int state = 0; - (void)display; if (index & 0x01) { state |= ShiftMask; @@ -568,14 +566,13 @@ TkpInitKeymapInfo( void TkpSetKeycodeAndState( - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), KeySym keySym, XEvent *eventPtr) { int i; SHORT result; int shift; - (void)tkwin; eventPtr->xkey.keycode = 0; if (keySym == NoSymbol) { @@ -627,12 +624,11 @@ TkpSetKeycodeAndState( KeyCode XKeysymToKeycode( - Display *display, + TCL_UNUSED(Display *), KeySym keysym) { int i; SHORT result; - (void)display; /* * We check our private map first for a virtual keycode, as VkKeyScan will @@ -676,10 +672,9 @@ XKeysymToKeycode( XModifierKeymap * XGetModifierMapping( - Display *display) + TCL_UNUSED(Display *)) { XModifierKeymap *map = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap)); - (void)display; map->max_keypermod = 1; map->modifiermap = (KeyCode *)ckalloc(sizeof(KeyCode) * 8); @@ -738,10 +733,8 @@ XFreeModifiermap( KeySym XStringToKeysym( - _Xconst char *string) + TCL_UNUSED(_Xconst char *)) { - (void)string; - return NoSymbol; } @@ -763,10 +756,8 @@ XStringToKeysym( char * XKeysymToString( - KeySym keysym) + TCL_UNUSED(KeySym)) { - (void)keysym; - return NULL; } diff --git a/win/x86_64-w64-mingw32-nmakehlp.exe b/win/x86_64-w64-mingw32-nmakehlp.exe Binary files differnew file mode 100755 index 0000000..f821add --- /dev/null +++ b/win/x86_64-w64-mingw32-nmakehlp.exe |