Compiler Warnings
Brought to you by:
petasis
Compiling TkDND 2.8 with Tcl 8.6.7 and the Cygwin x86_64-w64-mingw32-g++ compiler generates the following warnings:
x86_64-w64-mingw32-g++ -DPACKAGE_NAME=\"tkdnd\" -DPACKAGE_TARNAME=\"tkdnd\" -DPACKAGE_VERSION=\"2.8\" -DPACKAGE_STRING=\"tkdnd\ 2.8\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DBUILD_tkdnd=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRSAFE_H=1 -DBUILD_tkdnd=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern -DNO_VIZ=/\*\*/ -DHAVE_NO_SEH=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_LSEEK64=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -DUNICODE -D_UNICODE -I"/cygdrive/c/Tcl8.6.7/include" -I"/cygdrive/c/Tcl8.6.7/src/tk8.6.7/generic" -I"/cygdrive/c/Tcl8.6.7/src/tk8.6.7/win" -I"/cygdrive/c/Tcl8.6.7/src/tk8.6.7/generic/ttk" -I""/cygdrive/c/Tcl8.6.7/src/tk8.6.7/xlib"" -I"/cygdrive/c/Tcl8.6.7/src/tk8.6.7/xlib" -g -O2 -pipe -Wall -static-libgcc -static-libstdc++ -c `echo ./win/TkDND_OleDND.cpp` -o TkDND_OleDND.o <command-line>:0:0: warning: "BUILD_tkdnd" redefined <command-line>:0:0: note: this is the location of the previous definition In file included from ./win/TkDND_OleDND.cpp:41:0: ./win/OleDND.h: In member function ‘virtual ULONG TkDND_FormatEtc::Release()’: ./win/OleDND.h:196:16: warning: deleting object of polymorphic class type ‘TkDND_FormatEtc’ which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] delete this; ^~~~ ./win/OleDND.h: In member function ‘virtual ULONG TkDND_DataObject::Release()’: ./win/OleDND.h:305:16: warning: deleting object of polymorphic class type ‘TkDND_DataObject’ which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] delete this; return 0; ^~~~ ./win/OleDND.h: In constructor ‘TkDND_DropTarget::TkDND_DropTarget(Tcl_Interp*, Tk_Window)’: ./win/OleDND.h:470:26: warning: ‘TkDND_DropTarget::tkwin’ will be initialized after [-Wreorder] Tk_Window tkwin; ^~~~~ ./win/OleDND.h:468:26: warning: ‘LONG TkDND_DropTarget::m_lRefCount’ [-Wreorder] LONG m_lRefCount; /* Reference count */ ^~~~~~~~~~~ ./win/OleDND.h:488:5: warning: when initialized here [-Wreorder] TkDND_DropTarget(Tcl_Interp *_interp, Tk_Window _tkwin) : ^~~~~~~~~~~~~~~~ ./win/OleDND.h: In member function ‘virtual ULONG TkDND_DropTarget::Release()’: ./win/OleDND.h:524:16: warning: deleting object of polymorphic class type ‘TkDND_DropTarget’ which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] delete this; return 0; ^~~~ ./win/OleDND.h: In member function ‘virtual ULONG TkDND_DropSource::Release()’: ./win/OleDND.h:1285:32: warning: deleting object of polymorphic class type ‘TkDND_DropSource’ which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] if (count == 0) { delete this; return 0; } ^~~~ ./win/TkDND_OleDND.cpp: In function ‘int TkDND_RegisterDragDropObjCmd(ClientData, Tcl_Interp*, int, Tcl_Obj* const*)’: ./win/TkDND_OleDND.cpp:68:54: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] Tcl_SetResult(interp, "out of memory", TCL_STATIC); ^ ./win/TkDND_OleDND.cpp:74:14: warning: deleting object of polymorphic class type ‘TkDND_DropTarget’ which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] delete pDropTarget; ^~~~~~~~~~~ ./win/TkDND_OleDND.cpp:80:14: warning: deleting object of polymorphic class type ‘TkDND_DropTarget’ which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] delete pDropTarget; ^~~~~~~~~~~ ./win/TkDND_OleDND.cpp: In function ‘int TkDND_DoDragDropObjCmd(ClientData, Tcl_Interp*, int, Tcl_Obj* const*)’: ./win/TkDND_OleDND.cpp:188:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] Tcl_SetResult(interp, "button must be either 1, 2, or 3", TCL_STATIC); ^ ./win/TkDND_OleDND.cpp:218:29: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] TCL_STATIC); ^ ./win/TkDND_OleDND.cpp:349:73: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] Tcl_SetResult(interp, "unable to create OLE Data object", TCL_STATIC); ^ ./win/TkDND_OleDND.cpp:356:79: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] Tcl_SetResult(interp, "unable to create OLE Drop Source object",TCL_STATIC ; ./win/TkDND_OleDND.cpp:371:69: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] case DROPEFFECT_COPY: Tcl_SetResult(interp, "copy", TCL_STATIC); break; ^ ./win/TkDND_OleDND.cpp:372:69: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] case DROPEFFECT_MOVE: Tcl_SetResult(interp, "move", TCL_STATIC); break; ^ ./win/TkDND_OleDND.cpp:373:69: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] case DROPEFFECT_LINK: Tcl_SetResult(interp, "link", TCL_STATIC); break; ^ ./win/TkDND_OleDND.cpp:376:52: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] Tcl_SetResult(interp, "refuse_drop", TCL_STATIC); ^ ./win/TkDND_OleDND.cpp: In function ‘int Tkdnd_Init(Tcl_Interp*)’: ./win/TkDND_OleDND.cpp:431:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] Tcl_SetResult(interp, "tkdnd requires Tk 8.3.3 or greater", TCL_STATIC); ^
Everything seems to work, but it would be reassuring if there weren't any warnings.
Please, can you use the sources from github?
https://github.com/petasis/tkdnd
And open a ticket there?
Version 2.9.2 removed all of the warnings. Thanks! The only one left is a
duplicate definition of BUILD_tkdn on the command line:
x86_64-w64-mingw32-g++ -DPACKAGE_NAME=\"tkdnd\" -DPACKAGE_TARNAME=\"tkdnd\"
-DPACKAGE_VERSION=\"2.9.2\" -DPACKAGE_STRING=\"tkdnd\ 2.9.2\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DBUILD_tkdnd=/**/
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRSAFE_H=1 -DBUILD_tkdnd=1
-DTCL_THREADS=1 -DUSE_TCL_STUBS=1 -DUSE_TCLOO_STUBS=1 -DUSE_TK_STUBS=1
-DMODULE_SCOPE=extern -DHAVE_NO_SEH=1 -DTCL_WIDE_INT_TYPE=long\ long
-DHAVE_STRUCT_STAT64=1 -DHAVE_LSEEK64=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1
-DUNICODE -D_UNICODE -I"C:/Tcl8.6.8/include"
-I"C:/Tcl8.6.8/src/tk8.6.8/generic" -I"C:/Tcl8.6.8/src/tk8.6.8/win"
-I"C:/Tcl8.6.8/src/tk8.6.8/generic/ttk" -I""C:/Tcl8.6.8/src/tk8.6.8/xlib""
-I"C:/Tcl8.6.8/src/tk8.6.8/xlib" -pipe -O2 -DNDEBUG -Wall -c
cygpath -m ./win/TkDND_OleDND.cpp
-o TkDND_OleDND.o<command-line>:0:0: warning: "BUILD_tkdnd" redefined
<command-line>:0:0: note: this is the location of the previous definition</command-line></command-line>
Do you want me to submit a ticket for this?
On Wed, Apr 17, 2019 at 7:06 AM Georgios Petasis petasis@users.sourceforge.net wrote:
Related
Bugs: #31