draco icon indicating copy to clipboard operation
draco copied to clipboard

MSVC2019 - Large number of warnings at /W1 and higher (1.4.1 release)

Open RichardTea opened this issue 4 years ago • 3 comments

I'm currently trying to add Draco support to an existing cmake project which compiles on MSVC2019 using /W4 /WX (Warning level 4, warnings-as-errors.)

Unfortunately the Draco libraries produce a very large number of warnings, even at /W1, and so cannot be compiled with /WX at all.

Common warnings:

  • C4018 signed/unsigned mismatch (W3)
  • C4100 unreferenced formal parameter (W4)
  • C4146 unary minus operator applied to unsigned type (W2) (These are almost certainly real bugs, eg parser_utils.cc line 154 will always be positive!)
  • C4244, C4267 conversion with possible loss of data (W2, W3, W4)
  • C4661 no suitable definition for explicit template instantiation (W1)
  • C4804 unsafe use of bool (W1)

It would be good if the Draco library could be compiled in MSVC2019 with /WX set.

RichardTea avatar Jan 22 '21 14:01 RichardTea

Several of these are definitely actual bugs!

RichardTea avatar Jan 22 '21 14:01 RichardTea

Thank you for the report.

The Draco team is aware of the large volume of noise that MSVC builds produce, but consider the situation a low priority until reproducible test cases demonstrating impactful bugs are provided.

I'm currently trying to add Draco support to an existing cmake project which compiles on MSVC2019 using /W4 /WX (Warning level 4, warnings-as-errors.)

My suggestion would be to avoid building draco whilst using /WX.

Unfortunately the Draco libraries produce a very large number of warnings, even at /W1, and so cannot be compiled with /WX at all.

The Draco team agrees that this situation is unfortunate.

Common warnings:

  • C4018 signed/unsigned mismatch (W3)
  • C4100 unreferenced formal parameter (W4)
  • C4146 unary minus operator applied to unsigned type (W2) (These are almost certainly real bugs, eg parser_utils.cc line 154 will always be positive!)

While this is not the cleanest way, the behavior is correct. The value returned via the pointer will not always be positive.

If you are aware of a reproducible test case that demonstrates a bug please provide it as we will be happy to investigate the situation.

tomfinegan avatar Jan 22 '21 23:01 tomfinegan

The following warnings must also be disabled via pragma in order to use the draco library:

#pragma warning(disable: 4018) // Signed/unsigned mismatch #pragma warning(disable: 4804) // Unsafe use of type 'bool'

RichardTea avatar Jan 26 '21 18:01 RichardTea