[vtkusers] A fix for MSVC warning D9025: overriding '/W1' with '/w'

Niels Dekker - address until 2018 niels_dekker_address_until_2018 at xs4all.nl
Wed Sep 23 12:40:44 EDT 2015

Hi Cory,

Thanks for the information. Actually, explaining why exactly those 
warnings appear might be the hardest part! It looks like the following 
is happening, for a subproject that was meant to have suppressed warnings:
   1. For such a subproject, VTK replaces any compiler option 
regarding warning-levels from CMAKE_C_FLAGS and CMAKE_CXX_FLAGS by 
'/w' and '-w'.
   2. CMake then created a Visual Studio project file ("*.vcxproj") 
that does not have any <WarningLevel> XML tag. Instead, CMake adds 
'/w' and '-w' to the <AdditionalOptions> XML tag.
   3. Visual Studio finds out that the <WarningLevel> tag is missing, 
and so it adds warning-level 1 ('/W1') as its default warning-level. 
However, it also adds those '/w' and '-w' from <AdditionalOptions> to 
the command-line.
   4. The C++ compiler (cl.exe) gets '/W1, as well as '/w' and '-w', 
so it complains about overriding '/W1' with '/w'.

Fortunately this problem does not occur when VTK uses '/W0', instead 
of '/w' or '-w'!

Kind regards, Niels

Cory Quammen wrote on September 23, 2015, 16:22:
> Niels,
> I saw that you contributed to ITK via gerrit. Contributing to VTK is
> similar, but it uses gitlab instead of gerrit. I wouldn't bother with
> a bug report for this issue - just explaining why the warnings appear
> in the commit message is sufficient.
> Thanks for offering to contribute! I will watch for your patch and
> shepherd it through the review process.
> Best,
> Cory
> On Wed, Sep 23, 2015 at 10:16 AM, Niels Dekker wrote:
>     Hi Cory,
>     Thank you! When I have time (hopefully before next Sunday), I'll
>     try to contribute the patch via your gitlab contribution process.
>     Is the process similar to ITK? And do you think I should create a
>     "ticket" or "bug report" for this little issue?
>     If I can't get it to work (or if it takes me too much time), I
>     hope someone else can do the patch for me, next week or so...
>        Kind regards, Niels
>     PS Also thanks to Audrius for the support  :-)
>     Cory Quammen wrote on September 23, 2015, 15:54:
>         Hi Niels,
>         This does sound like a good patch. Would you mind contributing
>         it via
>         our gitlab contribution process? Please see [1].
>         [1] https://gitlab.kitware.com/vtk/vtk/blob/master/CONTRIBUTING.md
>         Thank you,
>         Cory
>         On Wed, Sep 23, 2015 at 9:46 AM, Niels Dekker wrote:
>              Does anyone here think it would be nice to fix these MSVC
>         warnings?
>              Basically it's just a matter of replacing '/w' and '-w'
>         by '/W0',
>              in various CMake files of the VTK source tree, according
>         to the
>              patch/diff-file I attached last Sunday.
>     _______________________________________________
>     Powered by www.kitware.com <http://www.kitware.com>
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
>     Please keep messages on-topic and check the VTK FAQ at:
>     http://www.vtk.org/Wiki/VTK_FAQ
>     Search the list archives at: http://markmail.org/search/?q=vtkusers
>     Follow this link to subscribe/unsubscribe:
>     http://public.kitware.com/mailman/listinfo/vtkusers
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.

More information about the vtkusers mailing list