Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple warnings on MVSC 2022 #507

Open
izonfreak opened this issue Apr 15, 2024 · 0 comments
Open

Multiple warnings on MVSC 2022 #507

izonfreak opened this issue Apr 15, 2024 · 0 comments

Comments

@izonfreak
Copy link

izonfreak commented Apr 15, 2024

There are multiple warnings when compiling the project. I see that there are some sanity checks that verify that the values are in range. A lot of them are conversion errors (lost of data). I see that there are some sanity checks that verify that the values are in range. There are also some warnings in which "const" seems to be thrown away. (e.g., CipEpathSetLogicalValue)

[ 2%] Building C object src/utils/CMakeFiles/Utils.dir/random.c.obj
random.c
[ 4%] Building C object src/utils/CMakeFiles/Utils.dir/xorshiftrandom.c.obj
xorshiftrandom.c
C:[User]\OpENer\source\src\utils\xorshiftrandom.c(22): warning C4244: 'function': conversion from 'time_t' to 'uint32_t', possible loss of data
[ 6%] Building C object src/utils/CMakeFiles/Utils.dir/doublylinkedlist.c.obj
doublylinkedlist.c
[ 9%] Building C object src/utils/CMakeFiles/Utils.dir/enipmessage.c.obj
enipmessage.c
[ 11%] Linking C static library Utils.lib
[ 11%] Built target Utils
[ 13%] Building C object src/enet_encap/CMakeFiles/ENET_ENCAP.dir/cpf.c.obj
cpf.c
C:[User]\OpENer\source\src\enet_encap\cpf.c(167): warning C4244: '=': conversion from 'EipUint32' to 'CipUint', possible loss of data
[ 15%] Building C object src/enet_encap/CMakeFiles/ENET_ENCAP.dir/encap.c.obj
encap.c
C:[User]\OpENer\source\src\enet_encap\encap.c(280): warning C4267: 'function': conversion from 'size_t' to 'const EipUint16', possible loss of data
C:[User]\OpENer\source\src\enet_encap\encap.c(692): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
[ 18%] Building C object src/enet_encap/CMakeFiles/ENET_ENCAP.dir/endianconv.c.obj
endianconv.c
[ 20%] Linking C static library ENET_ENCAP.lib
[ 20%] Built target ENET_ENCAP
[ 22%] Building C object src/cip/CMakeFiles/CIP.dir/appcontype.c.obj
appcontype.c
[ 25%] Building C object src/cip/CMakeFiles/CIP.dir/cipassembly.c.obj
cipassembly.c
C:[User]\OpENer\source\src\cip\cipassembly.c(61): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipassembly.c(66): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
[ 27%] Building C object src/cip/CMakeFiles/CIP.dir/cipclass3connection.c.obj
cipclass3connection.c
[ 29%] Building C object src/cip/CMakeFiles/CIP.dir/cipcommon.c.obj
cipcommon.c
C:[User]\OpENer\source\src\cip\cipcommon.c(297): warning C4244: '=': conversion from 'const int' to 'EipUint16', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(298): warning C4244: '=': conversion from 'const EipUint32' to 'EipUint16', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(299): warning C4244: '=': conversion from 'const int' to 'EipUint16', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(322): warning C4244: '=': conversion from 'int' to 'EipUint16', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(323): warning C4244: '=': conversion from 'const EipUint32' to 'EipUint16', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(324): warning C4244: '=': conversion from 'const int' to 'EipUint16', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(394): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipcommon.c(998): warning C4244: '=': conversion from 'CipDint' to 'CipReal', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(1007): warning C4244: '=': conversion from 'EipUint64' to 'CipLreal', possible loss of data
C:[User]\OpENer\source\src\cip\cipcommon.c(1371): warning C4244: 'function': conversion from 'const EipUint16' to 'const EipUint8', possible loss of data
[ 31%] Building C object src/cip/CMakeFiles/CIP.dir/cipconnectionobject.c.obj
cipconnectionobject.c
C:[User]\OpENer\source\src\cip\cipconnectionobject.c(466): warning C4244: '=': conversion from 'CipUdint' to 'CipUint', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionobject.c(470): warning C4244: '=': conversion from 'CipUdint' to 'CipUint', possible loss of data
[ 34%] Building C object src/cip/CMakeFiles/CIP.dir/cipconnectionmanager.c.obj
cipconnectionmanager.c
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(230): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(254): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(478): warning C4244: 'function': conversion from 'EipUint32' to 'EipUint8', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(494): warning C4245: '=': conversion from 'int' to 'EipUint32', signed/unsigned mismatch
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(504): warning C4244: 'function': conversion from 'EipUint32' to 'EipUint8', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(768): warning C4244: '=': conversion from 'int' to 'CipUsint', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(817): warning C4244: '=': conversion from 'int' to 'CipUsint', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(910): warning C4244: 'function': conversion from 'uint64_t' to 'const EipUint32', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(931): warning C4244: 'function': conversion from 'uint64_t' to 'const EipUint32', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(1049): warning C4244: '=': conversion from 'int' to 'CipUsint', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(1348): warning C4245: 'return': conversion from 'int' to 'EipUint8', signed/unsigned mismatch
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(1655): warning C4267: '=': conversion from 'size_t' to 'EipUint16', possible loss of data
C:[User]\OpENer\source\src\cip\cipconnectionmanager.c(1669): warning C4267: '=': conversion from 'size_t' to 'EipUint16', possible loss of data
[ 36%] Building C object src/cip/CMakeFiles/CIP.dir/cipdlr.c.obj
cipdlr.c
C:[User]\OpENer\source\src\cip\cipdlr.c(100): warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
C:[User]\OpENer\source\src\cip\cipdlr.c(138): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
[ 38%] Building C object src/cip/CMakeFiles/CIP.dir/cipethernetlink.c.obj
cipethernetlink.c
C:[User]\OpENer\source\src\cip\cipethernetlink.c(261): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
[ 40%] Building C object src/cip/CMakeFiles/CIP.dir/cipidentity.c.obj
cipidentity.c
C:[User]\OpENer\source\src\cip\cipidentity.c(234): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipidentity.c(238): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,const CipMessageRouterRequest *const ,CipMessageRouterResponse *const )' differs in parameter lists from 'CipCallback'
C:[User]\OpENer\source\src\cip\cipidentity.c(287): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipidentity.c(290): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
[ 43%] Building C object src/cip/CMakeFiles/CIP.dir/cipioconnection.c.obj
cipioconnection.c
C:[User]\OpENer\source\src\cip\cipioconnection.c(110): warning C4244: 'function': conversion from 'CipUdint' to 'const CipUint', possible loss of data
C:[User]\OpENer\source\src\cip\cipioconnection.c(179): warning C4244: '=': conversion from 'int' to 'CipInt', possible loss of data
C:[User]\OpENer\source\src\cip\cipioconnection.c(153): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
C:[User]\OpENer\source\src\cip\cipioconnection.c(274): warning C4244: '=': conversion from 'int' to 'CipInt', possible loss of data
C:[User]\OpENer\source\src\cip\cipioconnection.c(249): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
C:[User]\OpENer\source\src\cip\cipioconnection.c(693): warning C4244: 'function': conversion from 'unsigned int' to 'const EipUint16', possible loss of data
[ 45%] Building C object src/cip/CMakeFiles/CIP.dir/cipmessagerouter.c.obj
cipmessagerouter.c
C:[User]\OpENer\source\src\cip\cipmessagerouter.c(78): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipmessagerouter.c(100): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipmessagerouter.c(188): warning C4244: 'function': conversion from 'int' to 'EipInt16', possible loss of data
C:[User]\OpENer\source\src\cip\cipmessagerouter.c(259): warning C4244: '=': conversion from 'int' to 'EipInt16', possible loss of data
[ 47%] Building C object src/cip/CMakeFiles/CIP.dir/ciptcpipinterface.c.obj
ciptcpipinterface.c
C:[User]\OpENer\source\src\cip\ciptcpipinterface.c(370): warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
C:[User]\OpENer\source\src\cip\ciptcpipinterface.c(671): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\ciptcpipinterface.c(678): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
[ 50%] Building C object src/cip/CMakeFiles/CIP.dir/cipepath.c.obj
cipepath.c
C:[User]\OpENer\source\src\cip\cipepath.c(645): warning C4047: 'function': 'ENIPMessage *const ' differs in levels of indirection from 'const CipOctet **'
C:[User]\OpENer\source\src\cip\cipepath.c(645): warning C4024: 'MoveMessageNOctets': different types for formal and actual parameter 2
C:[User]\OpENer\source\src\cip\cipepath.c(648): warning C4047: 'function': 'CipMessageRouterResponse *const ' differs in levels of indirection from 'CipOctet **'
C:[User]\OpENer\source\src\cip\cipepath.c(648): warning C4024: 'CipEpathSetLogicalValue': different types for formal and actual parameter 3
C:[User]\OpENer\source\src\cip\cipepath.c(659): warning C4047: 'function': 'ENIPMessage *const ' differs in levels of indirection from 'const CipOctet **'
C:[User]\OpENer\source\src\cip\cipepath.c(659): warning C4024: 'MoveMessageNOctets': different types for formal and actual parameter 2
C:[User]\OpENer\source\src\cip\cipepath.c(662): warning C4047: 'function': 'CipMessageRouterResponse *const ' differs in levels of indirection from 'CipOctet **'
C:[User]\OpENer\source\src\cip\cipepath.c(662): warning C4024: 'CipEpathSetLogicalValue': different types for formal and actual parameter 3
C:[User]\OpENer\source\src\cip\cipepath.c(674): warning C4047: 'function': 'ENIPMessage *const ' differs in levels of indirection from 'const CipOctet **'
C:[User]\OpENer\source\src\cip\cipepath.c(674): warning C4024: 'MoveMessageNOctets': different types for formal and actual parameter 2
C:[User]\OpENer\source\src\cip\cipepath.c(677): warning C4047: 'function': 'CipMessageRouterResponse *const ' differs in levels of indirection from 'CipOctet **'
C:[User]\OpENer\source\src\cip\cipepath.c(677): warning C4024: 'CipEpathSetLogicalValue': different types for formal and actual parameter 3
[ 52%] Building C object src/cip/CMakeFiles/CIP.dir/cipelectronickey.c.obj
cipelectronickey.c
[ 54%] Building C object src/cip/CMakeFiles/CIP.dir/cipstring.c.obj
cipstring.c
[ 56%] Building C object src/cip/CMakeFiles/CIP.dir/cipstringi.c.obj
cipstringi.c
[ 59%] Building C object src/cip/CMakeFiles/CIP.dir/cipqos.c.obj
cipqos.c
C:[User]\OpENer\source\src\cip\cipqos.c(81): warning C4090: 'function': different 'const' qualifiers
C:[User]\OpENer\source\src\cip\cipqos.c(75): warning C4090: 'initializing': different 'const' qualifiers
C:[User]\OpENer\source\src\cip\cipqos.c(206): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
C:[User]\OpENer\source\src\cip\cipqos.c(208): warning C4113: 'EipStatus (__cdecl *)(CipInstance *restrict const ,CipMessageRouterRequest *const ,CipMessageRouterResponse *const ,const sockaddr *,const CipSessionHandle)' differs in parameter lists from 'const CipServiceFunction'
[ 61%] Building C object src/cip/CMakeFiles/CIP.dir/ciptypes.c.obj
ciptypes.c
[ 63%] Linking C static library CIP.lib
[ 63%] Built target CIP
[ 65%] Building C object src/ports/CMakeFiles/PLATFORM_GENERIC.dir/generic_networkhandler.c.obj
generic_networkhandler.c
MSG_NOSIGNAL not defined. Check if your system stops on SIGPIPE, as this can happen with the send() function
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(145): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(174): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(187): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(419): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(598): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(666): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(696): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(804): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(813): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(889): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(918): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
C:[User]\OpENer\source\src\ports\generic_networkhandler.c(988): warning C4189: 'error_message': local variable is initialized but not referenced
[ 68%] Building C object src/ports/CMakeFiles/PLATFORM_GENERIC.dir/socket_timer.c.obj
socket_timer.c
[ 70%] Linking C static library PLATFORM_GENERIC.lib
[ 70%] Built target PLATFORM_GENERIC
[ 72%] Building C object src/ports/WIN32/CMakeFiles/WIN32PLATFORM.dir/networkhandler.c.obj
networkhandler.c
Untested. Is a shutdown() needed under Windows like for the POSIX port?
[ 75%] Building C object src/ports/WIN32/CMakeFiles/WIN32PLATFORM.dir/opener_error.c.obj
opener_error.c
[ 77%] Building C object src/ports/WIN32/CMakeFiles/WIN32PLATFORM.dir/networkconfig.c.obj
networkconfig.c
C:[User]\OpENer\source\src\ports\WIN32\networkconfig.c(97): warning C4996: 'mbstowcs': This function or variable may be unsafe. Consider using mbstowcs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:[User]\OpENer\source\src\ports\WIN32\networkconfig.c(246): warning C4267: '=': conversion from 'size_t' to 'EipUint16', possible loss of data
[ 79%] Linking C static library WIN32PLATFORM.lib
[ 79%] Built target WIN32PLATFORM
[ 81%] Building C object src/ports/nvdata/CMakeFiles/NVDATA.dir/nvdata.c.obj
nvdata.c
[ 84%] Building C object src/ports/nvdata/CMakeFiles/NVDATA.dir/conffile.c.obj
conffile.c
[ 86%] Building C object src/ports/nvdata/CMakeFiles/NVDATA.dir/nvqos.c.obj
nvqos.c
[ 88%] Building C object src/ports/nvdata/CMakeFiles/NVDATA.dir/nvtcpip.c.obj
nvtcpip.c
[ 90%] Linking C static library NVDATA.lib
[ 90%] Built target NVDATA
[ 93%] Building C object src/ports/WIN32/sample_application/CMakeFiles/SAMPLE_APP.dir/sampleapplication.c.obj
sampleapplication.c
[ 95%] Linking C static library SAMPLE_APP.lib
[ 95%] Built target SAMPLE_APP
[ 97%] Building C object src/ports/WIN32/CMakeFiles/OpENer.dir/main.c.obj
main.c
C:[User]\OpENer\source\src\ports\WIN32\main.c(81): warning C4244: 'function': conversion from 'time_t' to 'unsigned int', possible loss of data
[100%] Linking C executable OpENe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant