[vtk-developers] Recent change to vtkTexture.h adds compiler warnings

David Cole david.cole at kitware.com
Thu Jun 26 14:10:04 EDT 2008


Sean....

If you change the value in vtkTexture.h from "-1" to "0xFFFFFFFF" does the
warning go away...?


Thx,
Dave


On Thu, Jun 26, 2008 at 1:54 PM, David C Thompson <dcthomp at sandia.gov>
wrote:

> Sorry, I hit send too soon... It would be nice to have the type safety
> there because when the ivars are declared as the enum type instead of
> "int" things like switch statements will generate warnings when an enum
> is not handled.
>
>        David
>
> > > I would suggest removing the enum name.
> > Would it be possible to change VTK_TEXTURE_BLENDING_MODE_NONE to a large
> > positive value? It would be nice to have the type safety in the Get/Set
> > methods.
> >
> >       David
> >
> > >
> > > Jeff
> > >
> > > ---------- Forwarded message ----------
> > > From: Sean McBride <sean at rogue-research.com>
> > > Date: Thu, Jun 26, 2008 at 1:08 PM
> > > Subject: [vtk-developers] Recent change to vtkTexture.h adds compiler
> warnings
> > > To: vtk-developers at vtk.org
> > >
> > >
> > > Hi all,
> > >
> > > Some warning flags produce far too many warnings with VTK's code but
> > > cause no problems for VTK's public headers.  For this reason, we're
> able
> > > to enable more warnings in our app than with our dashboards.  Up until
> > > very recently we were warning-free.
> > >
> > > This change:
> > > <http://public.kitware.com/cgi-bin/viewcvs.cgi/Rendering/vtkTexture.h?
> > > r1=1.62&r2=1.63>
> > >
> > > has introduced the warning (from gcc's -Wsign-promo):
> > >
> > > vtkTexture.h:171: warning: passing 'VTKTextureBlendingMode' chooses
> > > 'int' over 'unsigned int'
> > > vtkTexture.h:171: warning:   in call to 'vtkOStreamWrapper&
> > > vtkOStreamWrapper::operator<<(int)'
> > > vtkTexture.h: In member function 'virtual void
> > > vtkTexture::SetBlendingMode(VTKTextureBlendingMode)':
> > >
> > > This was added:
> > >
> > > typedef enum
> > > {
> > >  VTK_TEXTURE_BLENDING_MODE_NONE = -1,
> > >  VTK_TEXTURE_BLENDING_MODE_REPLACE = 0,
> > >  ...
> > > } VTKTextureBlendingMode;
> > >
> > > The compiler gets to decide the type and size of enums, which I guess
> is
> > > the root of the problem.  One fix would be:
> > >
> > > enum
> > > {
> > >  VTK_TEXTURE_BLENDING_MODE_NONE = -1,
> > >  VTK_TEXTURE_BLENDING_MODE_REPLACE = 0,
> > >  ...
> > > };
> > > typedef int VTKTextureBlendingMode;
> > >
> > > What are the coding standards in this situation?  VTK actually seems to
> > > almost never give a name to enums (I found only 2 others) so another
> > > option would be to remove 'VTKTextureBlendingMode' entirely and use
> > > 'int' in place.
> > >
> > > --
> > > ____________________________________________________________
> > > Sean McBride, B. Eng                 sean at rogue-research.com
> > > Rogue Research                        www.rogue-research.com
> > > Mac Software Developer              Montréal, Québec, Canada
> > >
> > >
> > > _______________________________________________
> > > vtk-developers mailing list
> > > vtk-developers at vtk.org
> > > http://www.vtk.org/mailman/listinfo/vtk-developers
> > >
> > >
> > >
> > > --
> > > Jeff Baumes, Ph.D.
> > > R&D Engineer, Kitware Inc.
> > > (518) 371-3971 x132
> > > jeff.baumes at kitware.com
> > > _______________________________________________
> > > vtk-developers mailing list
> > > vtk-developers at vtk.org
> > > http://www.vtk.org/mailman/listinfo/vtk-developers
> > >
>
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20080626/9ce6348f/attachment.html>


More information about the vtk-developers mailing list