[vtk-developers] Recent change to vtkTexture.h adds compiler warnings
Sean McBride
sean at rogue-research.com
Thu Jun 26 13:08:10 EDT 2008
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
More information about the vtk-developers
mailing list