Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-03-25
15:42 • Ticket [9c1dc88f86] warning about different signedness when compile TCL on Windo... artifact: 9e904fdaae user: sl1200mk2
15:34 • Closed ticket [9c1dc88f86]. artifact: 122b513a98 user: jan.nijtmans
15:31
Fix [9c1dc88f86]: warning about different signedness when compile TCL on Windows. check-in: 5a3df78fb4 user: jan.nijtmans tags: core-8-branch
14:56 • Ticket [9c1dc88f86] warning about different signedness when compile TCL on Windo... artifact: 49fed9d460 user: sl1200mk2
2022-03-22
20:21 • Ticket [9c1dc88f86]: 3 changes artifact: 8261e90aaa user: jan.nijtmans
2022-03-17
16:27 • New ticket [9c1dc88f86]. artifact: efaabd7fca user: sl1200mk2

warning about different signedness when compile TCL on Windows

Closed / Fixed9c1dc88f86e8766bba634db228f1ed3cf034e3b4Created 5 years agoUpdated 5 years ago
Descriptionplain2022-03-17 16:27:34
Hi Jan,
when compiling latest core-8-branch on Windows (using gcc) I got the following warnings:

C:/Users/nico/dev/dlight/win64/tcltk/tcl-9f61609437/generic/tclLink.c: In function 'LinkTraceProc':
C:/Users/nico/dev/dlight/win64/tcltk/tcl-9f61609437/generic/tclLink.c:943:41: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  943 |     ((value) >= (lowerLimit) && (value) <= (upperLimit))
      |                                         ^~
C:/Users/nico/dev/dlight/win64/tcltk/tcl-9f61609437/generic/tclLink.c:1120:29: note: in expansion of macro 'InRange'
 1120 |                         || !InRange(0, valueInt, USHRT_MAX)) {
      |                             ^~~~~~~
C:/Users/nico/dev/dlight/win64/tcltk/tcl-9f61609437/generic/tclLink.c:943:41: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  943 |     ((value) >= (lowerLimit) && (value) <= (upperLimit))
      |                                         ^~
C:/Users/nico/dev/dlight/win64/tcltk/tcl-9f61609437/generic/tclLink.c:1130:25: note: in expansion of macro 'InRange'
 1130 |                     || !InRange(0, valueInt, USHRT_MAX)) {
      |                         ^~~~~~~


best regards,
Nicolas
Referenced by1
  • 5a3df78fb4Fix [9c1dc88f86]: warning about different signedness when compile TCL on Windows. check-in2022-03-25 15:31:10
jan.nijtmanswiki2022-03-22 20:21:27

I cannot reproduce this.

How is USHRT_MAX defined in your compiler? It should be something like 0xffff, which is an integer.

sl1200mk2plain2022-03-25 14:56:17
Hi Jan,
sorry for the late reply...
not here, here in limits.h USHRT_MAX is defined as
#define USHRT_MAX 0xffffU

this is gcc 11.2.0 (Rev10, Built by MSYS2 project)

++
jan.nijtmanswiki2022-03-25 15:34:44

Even though I think this is a bug in this gcc build, fixed now. Since the same could happen with UINT_MAX and UCHAR_MAX, added a type-cast there too.

Thanks!

sl1200mk2plain2022-03-25 15:42:04
it's defined as follow:
#define UCHAR_MAX 0xff
#define UINT_MAX 0xffffffffU
#define ULONG_MAX 0xffffffffUL
#define ULLONG_MAX 0xffffffffffffffffull


++
Log in (anonymous is fine) to add a comment.