Ticket UUID: | 36bcf04a704a22f3578ea0d93e0401eb5d0afcb3 | |||
Title: | Pointer size warnings when compiling on a 32-bit machine | |||
Type: | Bug | Version: | Current | |
Submitter: | stu | Created on: | 2023-08-09 11:18:23 | |
Subsystem: | 52. Portability Support | Assigned To: | jan.nijtmans | |
Priority: | 5 Medium | Severity: | Important | |
Status: | Closed | Last Modified: | 2023-08-28 08:06:13 | |
Resolution: | Fixed | Closed By: | jan.nijtmans | |
Closed on: | 2023-08-28 08:06:13 | |||
Description: |
Edited to shorten paths: generic/tclInt.h:4358:12: warning: incompatible pointer types passing 'Tcl_Size *' (aka 'long *') to parameter of type 'int *' [-Wincompatible-pointer-types] return TclGetIntFromObj(interp, objPtr, sizePtr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ generic/tclInt.h:2757:46: note: expanded from macro 'TclGetIntFromObj' : Tcl_GetIntFromObj((interp), (objPtr), (intPtr))) ^~~~~~~~ generic/tclDecls.h:152:27: note: passing argument to parameter 'intPtr' here Tcl_Obj *objPtr, int *intPtr); | |||
User Comments: |
jan.nijtmans added on 2023-08-28 08:06:13:
> should Tcl just check sizeof(…) instead? It doesn't really matter (IMHO), but since TCL_SIZE_MAX is non-C-standard it would be - slightly - better. Closing. [e94242449556e1fd] chrstphrchvz added on 2023-08-28 06:39:37: The patch I attached was superseded by [2e65fce4cf]. But should Tcl be assuming that TCL_SIZE_MAX == INT_MAX implies sizeof(Tcl_Size) == sizeof(int)? Since the condition is no longer meant for the preprocessor, should Tcl just check sizeof(…) instead? chrstphrchvz added on 2023-08-10 11:45:06: The warning is about how C considers pointers to different integer types to be incompatible, regardless of whether the types have the same size. TCL_SIZE_MAX == INT_MAX does not necessarily mean Tcl_Size is int. Using a temporary int avoids the warning; see attached patch. |
Attachments:
- 36bcf04a70.diff [download] added by chrstphrchvz on 2023-08-10 11:44:58. [details]