Tk Source Code

View Ticket
Login
Ticket UUID: 832c2047bb5fb3173a4c5b71819a1dba13cee0f9
Title: Windows: new compiler, new warnings...
Type: Support Version: trunk
Submitter: nab Created on: 2025-09-22 13:56:00
Subsystem: 85. Win Build Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2025-09-23 19:03:46
Resolution: Fixed Closed By: nab
    Closed on: 2025-09-23 19:03:46
Description:
Hi,
today I've updated Clang compiler I use (ucrt64) and it displays some new warnings:

C:/Users/sl120/dev/dlight/win64/clangLib64/build/tk/xlib/xcolors.c:48:5: warning:
      initializer-string for character array is too long, array size is 32 but initializer has size
      33 (including the null terminating character); did you mean to use the 'nonstring' attribute?
      [-Wunterminated-string-initialization]
   48 |     "ntiqueWhite\0    \213\203\170\315\300\260\356\337\314\377\357\333\372\353\327\4",
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




In file included from winMain.c:34:
In file included from C:/Users/sl120/dev/dlight/win64/clangLib64/build/tk/generic/tk.h:19:
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tcl.h:2300:48: warning: identifier
      'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
 2300 | EXTERN const char *TclZipfs_AppHook(int *argc, wchar_t ***argv);
      |                                                ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tcl.h:2309:57: warning: identifier
      'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
 2309 |     EXTERN TCL_NORETURN void Tcl_MainExW(Tcl_Size argc, wchar_t **argv,
      |                                                         ^
In file included from winMain.c:34:
In file included from C:/Users/sl120/dev/dlight/win64/clangLib64/build/tk/generic/tk.h:19:
In file included from C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tcl.h:2359:
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclPlatDecls.h:36:10: warning:
      identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
   36 |         typedef wchar_t TCHAR;
      |                 ^



best regards,
nicolas
User Comments: nab added on 2025-09-23 19:03:46:
thanks Jan,
yes the -Wjump-misses-init things are fixed.

last ones are those:

/ucrt64/bin/clang.exe -c -I"." -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/libtommath" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/compat/zlib" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/win" -O3 -g0 -fomit-frame-pointer -DMP_FIXED_CUTOFFS -DUTF8PROC_STATIC -D__USE_MINGW_ANSI_STDIO=0 -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Wc++-compat -Wno-c++-keyword -fextended-identifiers  -DMP_PREC=4 -pipe -DHAVE_CPUID=1 -finput-charset=UTF-8 -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"9.1\" -DPACKAGE_STRING=\"tcl\ 9.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DTCL_CFGVAL_ENCODING=\"utf-8\" -DMODULE_SCOPE=extern -DTCL_CFG_DO64BIT=1 -DHAVE_NO_SEH=1 -DHAVE_CAST_TO_UNION=1 -DTCL_WITH_EXTERNAL_TOMMATH=1 -DMP_64BIT=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DZIPFS_BUILD=1 -DHAVE_INTRIN_H=1 -DHAVE_CPUID_H=1 -DHAVE_WSPIAPI_H=1 -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1   -DBUILD_tcl "C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORChan.c" -o tclIORChan.o
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORChan.c:1206:51: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 1206 |         ForwardOpToHandlerThread(rcPtr, ForwardedClose, &p);
      |                                                          ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORChan.c:1174:55: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 1174 |             ForwardOpToHandlerThread(rcPtr, ForwardedClose, &p);
      |                                                              ^
/ucrt64/bin/clang.exe -c -I"." -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/libtommath" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/compat/zlib" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/win" -O3 -g0 -fomit-frame-pointer -DMP_FIXED_CUTOFFS -DUTF8PROC_STATIC -D__USE_MINGW_ANSI_STDIO=0 -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Wc++-compat -Wno-c++-keyword -fextended-identifiers  -DMP_PREC=4 -pipe -DHAVE_CPUID=1 -finput-charset=UTF-8 -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"9.1\" -DPACKAGE_STRING=\"tcl\ 9.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DTCL_CFGVAL_ENCODING=\"utf-8\" -DMODULE_SCOPE=extern -DTCL_CFG_DO64BIT=1 -DHAVE_NO_SEH=1 -DHAVE_CAST_TO_UNION=1 -DTCL_WITH_EXTERNAL_TOMMATH=1 -DMP_64BIT=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DZIPFS_BUILD=1 -DHAVE_INTRIN_H=1 -DHAVE_CPUID_H=1 -DHAVE_WSPIAPI_H=1 -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1   -DBUILD_tcl "C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORTrans.c" -o tclIORTrans.o
2 warnings generated.
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORTrans.c:971:49: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
  971 |         ForwardOpToOwnerThread(rtPtr, ForwardedClose, &p);
      |                                                        ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORTrans.c:914:53: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
  914 |             ForwardOpToOwnerThread(rtPtr, ForwardedClose, &p);
      |                                                            ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORTrans.c:3178:49: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 3178 |         ForwardOpToOwnerThread(rtPtr, ForwardedDrain, &p);
      |                                                        ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORTrans.c:3228:49: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 3228 |         ForwardOpToOwnerThread(rtPtr, ForwardedFlush, &p);
      |                                                        ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORTrans.c:3283:49: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 3283 |         ForwardOpToOwnerThread(rtPtr, ForwardedClear, &p);
      |                                                        ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclIORTrans.c:3315:49: warning:
      variable 'p' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 3315 |         ForwardOpToOwnerThread(rtPtr, ForwardedLimit, &p);
      |                                                        ^

jan.nijtmans added on 2025-09-23 17:53:10:

This should be fixedhere

Thanks!


nab added on 2025-09-23 14:56:09:
it's clean, thanks !!

there's few more warnings (that I didn't saw among all the noise....):

/ucrt64/bin/clang.exe -c -I"." -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/libtommath" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/compat/zlib" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/win" -O3 -g0 -fomit-frame-pointer -DMP_FIXED_CUTOFFS -DUTF8PROC_STATIC -D__USE_MINGW_ANSI_STDIO=0 -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Wc++-compat -Wno-c++-keyword -fextended-identifiers  -DMP_PREC=4 -pipe -DHAVE_CPUID=1 -finput-charset=UTF-8 -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"9.1\" -DPACKAGE_STRING=\"tcl\ 9.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DTCL_CFGVAL_ENCODING=\"utf-8\" -DMODULE_SCOPE=extern -DTCL_CFG_DO64BIT=1 -DHAVE_NO_SEH=1 -DHAVE_CAST_TO_UNION=1 -DTCL_WITH_EXTERNAL_TOMMATH=1 -DMP_64BIT=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DZIPFS_BUILD=1 -DHAVE_INTRIN_H=1 -DHAVE_CPUID_H=1 -DHAVE_WSPIAPI_H=1 -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1   -DBUILD_tcl "C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c" -o tclExecute.o
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5133:7: warning: jump from
      this goto statement to its label is incompatible with C++ [-Wjump-misses-init]
 5133 |                     goto lindexFastPath;
      |                     ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5164:6: note: jump
      bypasses variable initialization
 5164 |         int encIndex = TclGetInt4AtPtr(pc + 1);
      |             ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:4652:2: warning: jump from
      this goto statement to its label is incompatible with C++ [-Wjump-misses-init]
 4652 |         goto processJumpTableEntry;
      |         ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:4661:20: note: jump
      bypasses variable initialization
 4661 |         JumptableNumInfo *jtnPtr = (JumptableNumInfo *)
      |                           ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5025:5: warning: jump from
      switch statement to this case label is incompatible with C++ [-Wjump-misses-init]
 5025 |     case INST_TCLOO_ID:
      |     ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5020:6: note: jump
      bypasses variable initialization
 5020 |         int match = oPtr != NULL;
      |             ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5024:5: warning: jump from
      switch statement to this case label is incompatible with C++ [-Wjump-misses-init]
 5024 |     case INST_TCLOO_NS:
      |     ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5020:6: note: jump
      bypasses variable initialization
 5020 |         int match = oPtr != NULL;
      |             ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5023:5: warning: jump from
      switch statement to this case label is incompatible with C++ [-Wjump-misses-init]
 5023 |     case INST_TCLOO_CLASS:
      |     ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:5020:6: note: jump
      bypasses variable initialization
 5020 |         int match = oPtr != NULL;
      |             ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:4659:5: warning: jump from
      switch statement to this case label is incompatible with C++ [-Wjump-misses-init]
 4659 |     case INST_JUMP_TABLE_NUM:
      |     ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclExecute.c:4648:17: note: jump
      bypasses variable initialization
 4648 |         JumptableInfo *jtPtr = (JumptableInfo *)
      |                        ^



/ucrt64/bin/clang.exe -c -I"." -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/libtommath" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/compat/zlib" -I"C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/win" -O3 -g0 -fomit-frame-pointer -DMP_FIXED_CUTOFFS -DUTF8PROC_STATIC -D__USE_MINGW_ANSI_STDIO=0 -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Wc++-compat -Wno-c++-keyword -fextended-identifiers  -DMP_PREC=4 -pipe -DHAVE_CPUID=1 -finput-charset=UTF-8 -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"9.1\" -DPACKAGE_STRING=\"tcl\ 9.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DTCL_CFGVAL_ENCODING=\"utf-8\" -DMODULE_SCOPE=extern -DTCL_CFG_DO64BIT=1 -DHAVE_NO_SEH=1 -DHAVE_CAST_TO_UNION=1 -DTCL_WITH_EXTERNAL_TOMMATH=1 -DMP_64BIT=1 -DHAVE_INTPTR_T=1 -DHAVE_UINTPTR_T=1 -DZIPFS_BUILD=1 -DHAVE_INTRIN_H=1 -DHAVE_CPUID_H=1 -DHAVE_WSPIAPI_H=1 -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1   -DBUILD_tcl "C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclProc.c" -o tclProc.o
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclProc.c:2933:6: warning: jump from
      this goto statement to its label is incompatible with C++ [-Wjump-misses-init]
 2933 |             goto procError;
      |             ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclProc.c:2944:20: note: jump bypasses
      variable initialization
 2944 |     Tcl_HashEntry *origHePtr = Tcl_FindHashEntry(iPtr->linePBodyPtr, origProc);
      |                    ^

jan.nijtmans added on 2025-09-23 14:34:14:

Can you try this?


nab added on 2025-09-23 14:22:41:
ok,
will you add it or should add it to my CFLAGS_OPTIMIZE ?

thanks

jan.nijtmans added on 2025-09-23 14:15:54:

See: https://github.com/llvm/llvm-project/issues/155988

I don't see any way to silence this warning, other than adding -Wno-c++-keyword to the compiler flags. It's correct usage of wchar_t.


nab added on 2025-09-23 13:46:15:
Hi Jan,
Tk is clean, thanks. but for Tcl compiler still reports lots of:

tclWinDde.c:349:25: warning: identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
  349 |             OutputDebugStringW(Tcl_UtfToWCharDString(
      |                                ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclDecls.h:4155:42: note: expanded from
      macro 'Tcl_UtfToWCharDString'
 4155 | #   define Tcl_UtfToWCharDString (sizeof(wchar_t) != sizeof(short) \
      |                                          ^
tclWinDde.c:349:25: warning: identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclDecls.h:4156:6: note: expanded from
      macro 'Tcl_UtfToWCharDString'
 4156 |                 ? (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))tclStubsPtr->tcl_UtfT...
      |                    ^
tclWinDde.c:349:25: warning: identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclDecls.h:4157:6: note: expanded from
      macro 'Tcl_UtfToWCharDString'
 4157 |                 : (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToChar16DString)
      |                    ^
tclWinDde.c:388:3: warning: identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
  388 |                 Tcl_UtfToWCharDString(Tcl_GetString(namePtr), -1, &ds);
      |                 ^
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclDecls.h:4155:42: note: expanded from
      macro 'Tcl_UtfToWCharDString'
 4155 | #   define Tcl_UtfToWCharDString (sizeof(wchar_t) != sizeof(short) \
      |                                          ^
tclWinDde.c:388:3: warning: identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclDecls.h:4156:6: note: expanded from
      macro 'Tcl_UtfToWCharDString'
 4156 |                 ? (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))tclStubsPtr->tcl_UtfT...
      |                    ^
tclWinDde.c:388:3: warning: identifier 'wchar_t' conflicts with a C++ keyword [-Wc++-keyword]
C:/Users/sl120/dev/dlight/win64/clangLib64/build/tcl/generic/tclDecls.h:4157:6: note: expanded from
      macro 'Tcl_UtfToWCharDString'
 4157 |                 : (wchar_t *(*)(const char *, Tcl_Size, Tcl_DString *))Tcl_UtfToChar16DString)
      |                    ^


++

jan.nijtmans added on 2025-09-23 12:29:03:

Fixed [14e1bb4f6e92edcd|here]

Thanks for the report!