Type conversion warnings on Windows+MSVC
eyalroz opened this issue · comments
We're getting lots and lots of warnings building dbgen
with MSVC:
\src\bcd2.c(84): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [\dbgen.vcxproj]
\src\bcd2.c(107): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [\dbgen.vcxproj]
\src\bcd2.c(129): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data [\dbgen.vcxproj]
\src\bcd2.c(130): warning C4244: '+=': conversion from '__int64' to 'int', possible loss of data [\dbgen.vcxproj]
\src\bcd2.c(134): warning C4244: '+=': conversion from '__int64' to 'int', possible loss of data [\dbgen.vcxproj]
\src\bcd2.c(144): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [\dbgen.vcxproj]
\src\bcd2.c(165): warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data [\dbgen.vcxproj]
bm_utils.c
\src\bm_utils.c(111): warning C4273: 'getenv': inconsistent dll linkage [\dbgen.vcxproj]
c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\stdlib.h(1191): note: see previous definition of 'getenv'
build.c
\src\build.c(252): warning C4244: 'function': conversion from 'double' to 'long', possible loss of data [\dbgen.vcxproj]
driver.c
\src\driver.c(842): warning C4244: '*=': conversion from 'double' to 'long', possible loss of data [\dbgen.vcxproj]
\src\driver.c(1157): warning C4244: '=': conversion from 'double' to 'long', possible loss of data [\dbgen.vcxproj]
load_stub.c
permute.c
print.c
\src\print.c(764): warning C4244: '+=': conversion from '__int64' to 'unsigned long', possible loss of data [\dbgen.vcxproj]
rnd.c
speed_seed.c
\src\speed_seed.c(123): warning C4244: '=': conversion from '__int64' to 'RND', possible loss of data [\dbgen.vcxproj]
\src\speed_seed.c(135): warning C4244: 'function': conversion from '__int64' to 'RND', possible loss of data [\dbgen.vcxproj]
text.c
Generating Code...
and about the same errors when building qgen.
In this issue, we'll consider just the type conersion, not the DLL linkage warning. These might be due to the fact that we kept an int
type for BCD arithmetic function return types. Let's change those and see what happens.
@valco1994 : FYI.
Ok, I will look at it too
It's looking depressing. I have tried to fix part of warnings and get even more as result.
Wait, don't do it yet. This is affected by changes regarding other issues (e.g. SUPPORT_64BITS
).
@eyalroz, hello! I try to write to you via e-mail, but Gmail notifies, that address not found, so I write here.
Maybe, it worths to merge changes from additional_fixes
to master
? There are a lot of nice fixes and improvements. And fix of warnings on MSVC required by this issue (#65) can be done later in a separate PR.
If you triend E.Rozenberg@cwi.nl - that's gone. I'm at eyalroz@technion.ac.il .
Useful information related to this issue can be found in a discussion of issue #69.
The most important points are: