|
2021-01-06
| ||
| 18:18 | • Closed ticket [c975939973]: Usage of gnu_printf in latest mingw-w64 plus 6 other changes artifact: ddc7cd7b6e user: anonymous | |
| 17:49 | • Ticket [c975939973]: 3 changes artifact: a02d8c1cd1 user: jan.nijtmans | |
| 17:06 | • Open ticket [c975939973]. artifact: 3acc8ad848 user: anonymous | |
|
2021-01-05
| ||
| 07:29 | • Closed ticket [c975939973]. artifact: 8d34d923ec user: jan.nijtmans | |
|
2021-01-04
| ||
| 22:18 | • Open ticket [c975939973]. artifact: 90a04351b5 user: anonymous | |
|
2020-10-27
| ||
| 15:08 | • Closed ticket [c975939973]. artifact: c5e623e005 user: jan.nijtmans | |
|
2020-10-22
| ||
| 09:23 | (cherry-pick): Fix [c975939973]: Usage of gnu_printf in latest mingw-w64. Change (internal, windows... check-in: 71c2ffb382 user: jan.nijtmans tags: core-8-5-branch | |
|
2020-10-21
| ||
| 07:48 | Fix [c975939973]: Usage of gnu_printf in latest mingw-w64 check-in: c3c046d6a0 user: jan.nijtmans tags: core-8-6-branch | |
| 07:43 | • New ticket [c975939973] Usage of gnu_printf in latest mingw-w64. artifact: 8c768190b5 user: jan.nijtmans | |
| Ticket UUID: | c9759399735f1979a2e7931fd9f00da20f2fbb7e | |||
| Title: | Usage of gnu_printf in latest mingw-w64 | |||
| Type: | Bug | Version: | ||
| Submitter: | jan.nijtmans | Created on: | 2020-10-21 07:43:56 | |
| Subsystem: | 52. Portability Support | Assigned To: | jan.nijtmans | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2021-01-06 18:18:26 | |
| Resolution: | Remind | Closed By: | anonymous | |
| Closed on: | 2021-01-06 18:18:26 | |||
| Description: |
When compiling Tcl with latest mingw-w64, warnings like this arise:
tclWinSerial.c:1459:26: warning: 'I' flag used with ‘%x’ gnu_printf format [-Wformat=]
1459 | sprintf(channelName, "file%" TCL_I_MODIFIER "x", (size_t) infoPtr);
| ^~~~~~~
So we need to handle either using gnu printf with standard modifiers, either MSVC printf with microsoft's modifiers. | |||
| User Comments: |
anonymous added on 2021-01-06 18:18:26:
Oh, this was related to XP's C runtime. I completely forgot that Tcl still supports XP, even after seeing -D_ATL_XP_TARGETING=1 on the same line of the Makefile we are discussing :-( Well, the Makefile is patched on MSYS2-MINGW-packages build. Let's wait until TIP #592 is decided and then maybe we can stop caring about this stdio mess. I'm closing the bug as "Remind". Removing -D__USE_MINGW_ANSI_STDIO=0 from the Makefile would be good, when possible. Thank you. jan.nijtmans added on 2021-01-06 17:49:22: For 8.6, we are _very_ careful about upwards compatibility, and we still support Windows XP. That gives little room to change anything. Compiling with -D__USE_MINGW_ANSI_STDIO=1 will need a whole new printf library, either that will cause the need for an additional DLL, either it makes the binary larger. It's simply not worth the risk for standard 8.6, although in an Msys2 environment it would work just fine. So, you can patch away the -D__USE_MINGW_ANSI_STDIO=0 in the Makefile, if you want, that's fine. TIP #592 is being voted upon now, which means we are stopping support for pre-windows 7 machines for Tcl/Tk 8.7. That means we can start using "ll" in stead of "I64" on all platforms, and that would work in any __USE_MINGW_ANSI_STDIO mode. We'll see how that works out. Thanks! anonymous added on 2021-01-06 17:06:40: I64 works with MinGW when __USE_MINGW_ANSI_STDIO=1:
#include <stdio.h>
int main() {
long long a = 0x1234567890123456LL;
printf("a= %I64x\n", a);
}
$ gcc -D__USE_MINGW_ANSI_STDIO=1 mingw-stdio.c -o ms.exe && ./ms.exe
a= 1234567890123456
$ gcc -v
Using built-in specs.
COLLECT_GCC=c:\apps\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-10.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --disable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev6, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' 'LDFLAGS_FOR_TARGET=-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high' --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\ -pipe\ -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high\ -Wl,--stack,12582912'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (Rev6, Built by MSYS2 project)
(This is MinGW-w64, dunno about plain MinGW).
Forcing __USE_MINGW_ANSI_STDIO=0 can be problematic when Tcl/Tk are embedded in other applications that use __USE_MINGW_ANSI_STDIO=1 (which is the default for everything built by MSYS2's makepkg-mingw, for instance).
Until now, MSYS2 distributed Tcl/Tk binaries built with __USE_MINGW_ANSI_STDIO=1, so forcing __USE_MINGW_ANSI_STDIO=0 on Tcl's makefile (and placing it after CPPFLAGS/CFLAGS, which precludes the user from choosing his own setting) is a significant, possibly problematic change.
If you are sure that Tcl's impact of __USE_MINGW_ANSI_STDIO setting does not leak to the client applications and binary packages and will remain so, then we can close this issue for good.
Thanks for your work on Tlc/MinGW, I greatly appreciate it.
Óscar Fuentes, occasional maintainer of MSYS2 Tcl-related packages.
jan.nijtmans added on 2021-01-05 07:29:41: Since the gnu_printf() functions don't know about the Microsoft-specific modifiers (I/I32/I64), doing it otherwise would cause a binary incompatibility between Tcl 8.6.10 and 8.6.11. So you will have to describe the "(which brings in its own problems)". For now, closing. anonymous added on 2021-01-04 22:18:44: The right fix for this issue it not forcing -D__USE_MINGW_ANSI_STDIO=0 (which brings in its own problems), but doing the right thing when -D__USE_MINGW_ANSI_STDIO=1. This patch achieves that: diff -Naur tcl8.6.5-orig/win/tclWinInt.h tcl8.6.5/win/tclWinInt.h --- tcl8.6.11-orig/win/tclWinInt.h 2016-02-25 23:12:38.000000000 +0300 +++ tcl8.6.11/win/tclWinInt.h 2016-03-03 08:47:51.129171100 +0300 @@ -57,7 +57,7 @@ #ifndef TCL_Z_MODIFIER # ifdef _WIN64 # if defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO -# define TCL_Z_MODIFIER "ll" +# define TCL_Z_MODIFIER "I64" # else # define TCL_Z_MODIFIER "I" # endif jan.nijtmans added on 2020-10-27 15:08:53: Fixed in 8.6: [c3c046d6a00270d1] | |||