On Mon, 20 Oct 2025 at 20:18, Georg Baum <[email protected]>
wrote:

> Am 19.10.25 um 21:36 schrieb Scott Kostyshak:
> > On Sun, Oct 19, 2025 at 04:52:46PM +0200, Thibaut Cuvelier wrote:
> >> Hi all,
> >
> > Hi Thibaut,
> >
> >> Everytime I build LyX on Windows, that's with MSVC and I have a
> different
> >> set of warnings than with GCC or LLVM. Many of them are about type
> >> conversions, because MSVC doesn't use the same types underlying
> ptrdiff_t,
> >> size_t, and family.
>
> For those who are interested: Windows uses the LLP64 data model, Linux
> LP64 (see
> https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models for
> details).
>
> >> (Also, Clangd quite often triggers on the same lines
> >> for the same issues.) iconv and Hunspell also have their share of
> warnings,
> >> LyX is in good standing compared to them :).
>
> We should not fix warnings in thirdparty code, but upgrade to the newest
> versions instead. At least zlib and libiconv are outdated.
>
> > I'm sorry for you since it seems annoying, but I'm glad that we have
> > someone compiling with MSVC and looking at the warnings since in my
> > opinion the more compilers we have the better.
>
> +1
>
> >> I don't think it's important to solve them in the short term (it's
> unlikely
> >> they cause any bug), but overall we tend to avoid having none of them
> :).
>
> Definitely. The huge benefit of having a zero-warning build is that you
> easily spot new ones (which might actually hint at a bug).
>
> >> I'm attaching a full list of warnings (MSVC 14.44.35207, i.e. the latest
> >> one currently) and a patch that fixes some of them. Should I push it?
> Does
> >> it generate more warnings on other compilers?
> >
> > I tested with your patch on GCC and Clang and compilation went well
> > here.
>
> I did not test, but look at the patch. It looks good and should go in IMHO.


I went ahead and fixed many more such issues. Here is the list of remaining
ones, either at the intersection of an external library (and I'm not sure
what to do) or looking more like bugs (converting doubles to ints):

[472/614] Building CXX object
src\support\CMakeFiles\support.dir\checksum.cpp.obj
D:\LyX\lyx\src\support\checksum.cpp(42): warning C4244: 'argument':
conversion from '__int64' to 'uInt', possible loss of data
[479/614] Building CXX object
src\support\CMakeFiles\support.dir\gzstream.cpp.obj
D:\LyX\lyx\src\support\gzstream.cpp(92): warning C4244: 'initializing':
conversion from '__int64' to 'int', possible loss of data
D:\LyX\lyx\src\support\gzstream.cpp(113): warning C4244: 'initializing':
conversion from '__int64' to 'int', possible loss of data
[484/614] Building CXX object
src\support\CMakeFiles\support.dir\ForkedCalls.cpp.obj
D:\LyX\lyx\src\support\ForkedCalls.cpp(216): warning C4312:
'<function-style-cast>': conversion from 'int' to 'HANDLE' of greater size
D:\LyX\lyx\src\support\ForkedCalls.cpp(417): warning C4311: 'type cast':
pointer truncation from 'HANDLE' to 'int'
D:\LyX\lyx\src\support\ForkedCalls.cpp(417): warning C4302: 'type cast':
truncation from 'HANDLE' to 'int'
D:\LyX\lyx\src\support\ForkedCalls.cpp(587): warning C4312:
'<function-style-cast>': conversion from 'int' to 'HANDLE' of greater size
[593/614] Building CXX object src\CMakeFiles\LyX.dir\TextMetrics.cpp.obj
D:\LyX\lyx\src\TextMetrics.cpp(1610): warning C4244: '+=': conversion from
'double' to 'int', possible loss of data
D:\LyX\lyx\src\TextMetrics.cpp(1637): warning C4244: 'return': conversion
from 'double' to 'int', possible loss of data

For the fixes, I tried to use the most semantically sound option that
solved the warning, but feel free to revert if you feel otherwise (I
touched a lot of code I'm not used to).
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to