Skip to content

Commit

Permalink
Eliminate some clang warnings. Only use "testbigdata" if sizeof(Tcl_S…
Browse files Browse the repository at this point in the history
…ize) == sizeof(Tcl_WideInt)
  • Loading branch information
jan.nijtmans committed May 25, 2023
1 parent 231fd11 commit 0657f97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions generic/tclTest.c
Expand Up @@ -5761,6 +5761,9 @@ TestbytestringObjCmd(
#if !defined(TCL_NO_DEPRECATED)
# if defined(_MSC_VER) && !defined(NDEBUG)
# pragma warning(disable:4133)
# elif defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wincompatible-pointer-types"
# endif
int n; /* On purpose, not Tcl_Size, in order to demonstrate what happens */
#else
Expand All @@ -5779,6 +5782,10 @@ TestbytestringObjCmd(
if (p == NULL) {
return TCL_ERROR;
}
#if !defined(TCL_NO_DEPRECATED) && defined(__clang__)
# pragma clang diagnostic pop
#endif

if (x.m != 1) {
Tcl_AppendResult(interp, "Tcl_GetBytesFromObj() overwrites variable", NULL);
return TCL_ERROR;
Expand Down
6 changes: 4 additions & 2 deletions generic/tclTestObj.c
Expand Up @@ -119,8 +119,10 @@ TclObjTest_Init(
Tcl_CreateObjCommand(interp, "testobj", TestobjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "teststringobj", TeststringobjCmd,
NULL, NULL);
Tcl_CreateObjCommand(interp, "testbigdata", TestbigdataCmd,
NULL, NULL);
if (sizeof(Tcl_Size) == sizeof(Tcl_WideInt)) {
Tcl_CreateObjCommand(interp, "testbigdata", TestbigdataCmd,
NULL, NULL);
}
return TCL_OK;
}

Expand Down

0 comments on commit 0657f97

Please sign in to comment.