View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001953VTK(No Category)public2005-06-20 10:552008-02-28 12:51
ReporterSean McBride 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001953: vtk uses deprecated 'strstream' STL class, causes warnings with gcc
DescriptionHello, I am using VTK from CVS (circa 2005-06-13) and when I include vtkCocoaGLView.h in my own projects I get a compilation warning:

"This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the ++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header iostream.h>. To disable this warning use -Wno-deprecated."

I am using gcc 4. The problem seems to be that vtkIOStream.h includes <strstream> which is apparently considered obsolete.

Its rather annoying, simply because of the way my crappy IDE (XCode) works, it takes many many lines up in my error window. :)

thanks.
TagsNo tags attached.
Project
Type
Attached Filestxt file icon vtk_patch.txt [^] (45,410 bytes) 1969-12-31 19:00 [Show Content]
patch file icon ostream.patch [^] (47,671 bytes) 1969-12-31 19:00 [Show Content]
txt file icon patchfileString.txt [^] (33,039 bytes) 1969-12-31 19:00 [Show Content]
txt file icon patchfileString_vtksys_ios.txt [^] (34,066 bytes) 1969-12-31 19:00 [Show Content]
txt file icon patchfileString20070319.txt [^] (36,013 bytes) 1969-12-31 19:00 [Show Content]

 Relationships
related to 0007734closedKitware Robot QVTKWidget.h generates a compiler warning on the use of depreciated or antiquated headers 

  Notes
(0002561)
Mathieu Malaterre (developer)
2005-06-28 14:20

Can you change the CMAKE_CXX_FLAGS in your CMakeCache.txt to contains: -Wno-deprecated.

And let me know if that fixes the problem

Thanks
Mathieu
(0002562)
Sean McBride (developer)
2005-06-28 14:48

Hi Mathieu,

I am aware of -Wno-deprecated (It is mentionned in my bug report :) ) and adding it to CMAKE_CXX_FLAGS would surely remove the warning when building vtk, but this is not my concern.

Because the warning appears from a vtk *header* I also get the warning in *my* application. That is the problem. Yes, I could use -Wno-deprecated in my app, but I don't want to because I like this warning (Apple uses it a lot in their headers, and it helps me get rid of using old Apple APIs)
(0002563)
Sean McBride (developer)
2005-06-28 15:06

More info:
<http://www.devx.com/tips/Tip/14133> [^]
<http://public.kitware.com/pipermail/vtkusers/2004-June/074739.html> [^]
<http://public.kitware.com/pipermail/vtkusers/2004-December/077841.html> [^]

So maybe this bug is a duplicate... But I'd really like to see it fixed!
(0002564)
Mathieu Malaterre (developer)
2005-06-28 15:17

Sean,

   If you really want to see this bug fixes, you are welcome to provide a patch for it. All you have to do is go over VTK code and change all instances of strstream and changes them into the vtk-ostringstream layer:

#include <vtksys/ios/sstream>

...

vtksys_ios::ostringstream str;
...

   Interested ?

Mathieu
(0002583)
Sean McBride (developer)
2005-07-04 13:26

Hi Mathieu, well I'm not a C++ programmer and have never used sstream and the like, so I'm not too comfortable making these kinds of changes. Maybe in the future I could do it.... :)
(0004538)
Sean McBride (developer)
2006-07-25 17:26

Mathieu, OK, this warning is driving me crazy, I'm willing to try and fix it, but I still don't know much about C++. :) The strstream class seems to only be used in 4 classes, so it should be easy to fix I hope.

For example, in vtkParticleReader.cxx:

 int operator () (vtkstd::string &s, T val[4])
 {
   // SNIP!

   // We have data.
   strstream is;
   is << s.c_str() << ends;// no istringstream in VTK
   is >> val[0] >> val[1] >> val[2] >> val[3];
 }

would I change that to:
  vtksys_ios::ostringstream is;

and then all the methods that strstream supports are also supported by vtksys_ios::ostringstream? Thanks.
   
(0004552)
Sean McBride (developer)
2006-07-26 18:00

OK, I have attached a _partial_ fix. I have changed most of the strstream, istrstream, and ostrstream to their vtksys_ios counterparts. It was mostly find&replace but of course I also had to add new #includes, and change a few APIs (str() -> c_str()), and added a few casts.

vtkDataWriter.cxx:1158 needs special attention, it is currently broken.

Please check my changes carefully. It compiles on my Mac, but I also changed unix & windows files that I cannot compile.

Please search the entire VTK source tree for strstream, istrstream, and ostrstream-- there are still 37 occurrences (down from >100). Some are #includes which I have not removed yet, that will be step 2. Other occurrences are in comments, some in strings, etc, I'm not sure what to do with any of these!

Also, some dashboard test fail, hopefully because of vtkDataWriter.cxx:1158.

90% tests passed, 10 tests failed out of 105
         94 - BoxWidget (Failed)
         95 - TestImplicitPlaneWidget (Failed)
         96 - TestOrientationMarkerWidget (Failed)
         97 - ImagePlaneWidget (Failed)
         98 - TestImageTracerWidget (Failed)
         99 - TestLineWidget (Failed)
        100 - TestPlaneWidget (Failed)
        101 - TestPointWidget (Failed)
        102 - TestScalarBarWidget (Failed)
        103 - TestSplineWidget (Failed)
(0004836)
Mathieu Malaterre (developer)
2006-09-03 20:50

review patch. Deferred for now.
To be done:
- still using 'ends',
- still calling delete[] on the char * returned
(0005621)
Sean McBride (developer)
2006-10-31 16:16

See also bug 1457.
(0006823)
Mathieu Coursolle (reporter)
2007-03-16 16:44

Here is a new patch which fixes this bug.

It removes the strstream code to replace it with <vtksys/ios/sstream> stringstream code.

I tested it on Mac OSX with Java/TCL/Python wrapping turned on and all tests passed.

However, in order to get rid of strstream, I had to change some code in files that I could not test.
(ex: vtkWin32OpenGLRenderWindow.cxx).

This patch (patchfileString.txt) fixes that bug, but still need to be tested on other platforms.
(0006836)
Mathieu Coursolle (reporter)
2007-03-19 13:22

patchfileString_vtksys_ios.txt uses explicit use of vtksys_ios:: prefix for stringstream.

This new patch should be use rather than patchfileString.txt.
(0006859)
Mathieu Coursolle (reporter)
2007-03-20 12:06

Here is provided another patch. This one allows the use of vtksys/ios/sstream even if VTK_USE_ANSI_STDLIB is not defined.

Attach patch: patchfileString20070319.txt
(0008472)
David Cole (developer)
2007-08-15 14:36

A (slightly) modified version of patchfileString20070319.txt has been applied to VTK today. Yay! Here is the commit log:

BUG: Fix bug 1953: replace strstream use with stringstream now that kwsys provides stringstream on all platforms. Many thanks to Sean McBride and Mathieu Coursolle from Rogue Research for all their effort developing the patch (and patience in waiting for its commit...!). COMP: Eliminate performance warning in generated Java wrappers regarding jboolean cast to bool. ENH: Exclude Java and Python wrappers (in addition to already excluded Tcl wrappers) from coverage analysis.

/cvsroot/VTK/VTK/CMake/CTestCustom.ctest.in,v <-- CTestCustom.ctest.in
new revision: 1.26; previous revision: 1.25
/cvsroot/VTK/VTK/Common/Testing/Cxx/otherArrays.cxx,v <-- otherArrays.cxx
new revision: 1.25; previous revision: 1.24
/cvsroot/VTK/VTK/Common/Testing/Cxx/otherByteSwap.cxx,v <-- otherByteSwap.cxx
new revision: 1.11; previous revision: 1.10
/cvsroot/VTK/VTK/Common/Testing/Cxx/otherStringArray.cxx,v <-- otherStringArray.cxx
new revision: 1.7; previous revision: 1.6
/cvsroot/VTK/VTK/Common/Testing/Cxx/otherTimerLog.cxx,v <-- otherTimerLog.cxx
new revision: 1.23; previous revision: 1.22
/cvsroot/VTK/VTK/Common/vtkGarbageCollector.cxx,v <-- vtkGarbageCollector.cxx
new revision: 1.31; previous revision: 1.30
/cvsroot/VTK/VTK/Common/vtkIOStream.h,v <-- vtkIOStream.h
new revision: 1.9; previous revision: 1.8
/cvsroot/VTK/VTK/Common/vtkObjectBase.cxx,v <-- vtkObjectBase.cxx
new revision: 1.16; previous revision: 1.15
/cvsroot/VTK/VTK/Common/vtkPythonUtil.cxx,v <-- vtkPythonUtil.cxx
new revision: 1.80; previous revision: 1.79
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/otherCellArray.cxx,v <-- otherCellArray.cxx
new revision: 1.2; previous revision: 1.1
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/otherCellBoundaries.cxx,v <-- otherCellBoundaries.cxx
new revision: 1.2; previous revision: 1.1
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/otherCellPosition.cxx,v <-- otherCellPosition.cxx
new revision: 1.2; previous revision: 1.1
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/otherColorTransferFunction.cxx,v <-- otherColorTransferFunction.cxx
new revision: 1.16; previous revision: 1.15
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/otherEmptyCell.cxx,v <-- otherEmptyCell.cxx
new revision: 1.2; previous revision: 1.1
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/otherRectilinearGrid.cxx,v <-- otherRectilinearGrid.cxx
new revision: 1.2; previous revision: 1.1
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/otherStructuredGrid.cxx,v <-- otherStructuredGrid.cxx
new revision: 1.2; previous revision: 1.1
/cvsroot/VTK/VTK/Filtering/Testing/Cxx/quadraticEvaluation.cxx,v <-- quadraticEvaluation.cxx
new revision: 1.4; previous revision: 1.3
/cvsroot/VTK/VTK/GenericFiltering/Testing/Cxx/otherCreation.cxx,v <-- otherCreation.cxx
new revision: 1.13; previous revision: 1.12
/cvsroot/VTK/VTK/Hybrid/vtkFacetReader.cxx,v <-- vtkFacetReader.cxx
new revision: 1.4; previous revision: 1.3
/cvsroot/VTK/VTK/Hybrid/vtkRIBExporter.cxx,v <-- vtkRIBExporter.cxx
new revision: 1.64; previous revision: 1.63
/cvsroot/VTK/VTK/IO/vtkDataReader.cxx,v <-- vtkDataReader.cxx
new revision: 1.146; previous revision: 1.145
/cvsroot/VTK/VTK/IO/vtkDataWriter.cxx,v <-- vtkDataWriter.cxx
new revision: 1.121; previous revision: 1.120
/cvsroot/VTK/VTK/IO/vtkFLUENTReader.cxx,v <-- vtkFLUENTReader.cxx
new revision: 1.14; previous revision: 1.13
/cvsroot/VTK/VTK/IO/vtkMINCImageAttributes.cxx,v <-- vtkMINCImageAttributes.cxx
new revision: 1.8; previous revision: 1.7
/cvsroot/VTK/VTK/IO/vtkOpenFOAMReader.cxx,v <-- vtkOpenFOAMReader.cxx
new revision: 1.10; previous revision: 1.9
/cvsroot/VTK/VTK/IO/vtkParticleReader.cxx,v <-- vtkParticleReader.cxx
new revision: 1.29; previous revision: 1.28
/cvsroot/VTK/VTK/IO/vtkWriter.cxx,v <-- vtkWriter.cxx
new revision: 1.45; previous revision: 1.44
/cvsroot/VTK/VTK/IO/vtkXMLDataElement.cxx,v <-- vtkXMLDataElement.cxx
new revision: 1.27; previous revision: 1.26
/cvsroot/VTK/VTK/IO/vtkXMLMultiGroupDataWriter.cxx,v <-- vtkXMLMultiGroupDataWriter.cxx
new revision: 1.5; previous revision: 1.4
/cvsroot/VTK/VTK/IO/vtkXMLPDataReader.cxx,v <-- vtkXMLPDataReader.cxx
new revision: 1.19; previous revision: 1.18
/cvsroot/VTK/VTK/IO/vtkXMLPDataWriter.cxx,v <-- vtkXMLPDataWriter.cxx
new revision: 1.16; previous revision: 1.15
/cvsroot/VTK/VTK/IO/vtkXMLPStructuredDataReader.cxx,v <-- vtkXMLPStructuredDataReader.cxx
new revision: 1.23; previous revision: 1.22
/cvsroot/VTK/VTK/IO/vtkXMLReader.cxx,v <-- vtkXMLReader.cxx
new revision: 1.46; previous revision: 1.45
/cvsroot/VTK/VTK/IO/vtkXMLUtilities.cxx,v <-- vtkXMLUtilities.cxx
new revision: 1.8; previous revision: 1.7
/cvsroot/VTK/VTK/Rendering/Testing/Cxx/otherCoordinate.cxx,v <-- otherCoordinate.cxx
new revision: 1.12; previous revision: 1.11
/cvsroot/VTK/VTK/Rendering/vtkCocoaRenderWindow.mm,v <-- vtkCocoaRenderWindow.mm
new revision: 1.52; previous revision: 1.51
/cvsroot/VTK/VTK/Rendering/vtkInteractorEventRecorder.cxx,v <-- vtkInteractorEventRecorder.cxx
new revision: 1.12; previous revision: 1.11
/cvsroot/VTK/VTK/Rendering/vtkWin32OpenGLRenderWindow.cxx,v <-- vtkWin32OpenGLRenderWindow.cxx
new revision: 1.148; previous revision: 1.147
/cvsroot/VTK/VTK/Rendering/vtkXOpenGLRenderWindow.cxx,v <-- vtkXOpenGLRenderWindow.cxx
new revision: 1.85; previous revision: 1.84
/cvsroot/VTK/VTK/Utilities/MaterialLibrary/ProcessShader.cxx,v <-- ProcessShader.cxx
new revision: 1.4; previous revision: 1.3
/cvsroot/VTK/VTK/VolumeRendering/vtkVREncodeString.cxx,v <-- vtkVREncodeString.cxx
new revision: 1.4; previous revision: 1.3
/cvsroot/VTK/VTK/Widgets/vtkBiDimensionalRepresentation2D.cxx,v <-- vtkBiDimensionalRepresentation2D.cxx
new revision: 1.22; previous revision: 1.21
/cvsroot/VTK/VTK/Wrapping/vtkWrapJava.c,v <-- vtkWrapJava.c
new revision: 1.59; previous revision: 1.58
/cvsroot/VTK/VTK/Wrapping/vtkWrapPython.c,v <-- vtkWrapPython.c
new revision: 1.85; previous revision: 1.84
/cvsroot/VTK/VTK/Wrapping/vtkWrapTcl.c,v <-- vtkWrapTcl.c
new revision: 1.51; previous revision: 1.50

Success, CVS operation completed
(0010423)
Sean McBride (developer)
2008-02-07 11:36

David,

I just noticed that "-Wno-deprecated" is added in vtkDetermineCompilerFlags.cmake. I suspect this was added to work around this bug, long long ago. I removed the flag and trying doing a clean build. I don't get any deprecated warnings. I'd like to remove the flag, to ensure people don't commit new code using deprecated constructs. Could you try on a non-Mac to be sure?

Index: CMake/vtkDetermineCompilerFlags.cmake
===================================================================
RCS file: /cvsroot/VTK/VTK/CMake/vtkDetermineCompilerFlags.cmake,v
retrieving revision 1.4
diff -r1.4 vtkDetermineCompilerFlags.cmake
21,22c21
< # A GCC compiler. Quiet warning about strstream deprecation.
< SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -Wno-deprecated")
---
> # A GCC compiler.
(0010641)
Sean McBride (developer)
2008-02-25 11:13

/cvsroot/VTK/VTK/CMake/vtkDetermineCompilerFlags.cmake,v <-- vtkDetermineCompilerFlags.cmake
new revision: 1.5; previous revision: 1.4
(0010649)
Sean McBride (developer)
2008-02-26 10:01

Last change caused dashboard warnings....
(0010650)
Sean McBride (developer)
2008-02-26 10:44

David, what do you think of this. I have _conditionally_ restored the warning suppression:

Index: CMake/vtkDetermineCompilerFlags.cmake
===================================================================
RCS file: /cvsroot/VTK/VTK/CMake/vtkDetermineCompilerFlags.cmake,v
retrieving revision 1.5
diff -r1.5 vtkDetermineCompilerFlags.cmake
20d19
< IF(CMAKE_COMPILER_IS_GNUCXX)
21a21,25
> IF(CMAKE_COMPILER_IS_GNUCXX)
> # Quiet warning about strstream deprecation if appropriate.
> IF(VTK_INCLUDE_STRSTREAM_HEADERS OR NOT VTK_LEGACY_REMOVE)
> SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -Wno-deprecated")
> ENDIF(VTK_INCLUDE_STRSTREAM_HEADERS OR NOT VTK_LEGACY_REMOVE)
(0010651)
Sean McBride (developer)
2008-02-26 15:55

Hopefully fixed for real this time! :)

/cvsroot/VTK/VTK/CMake/vtkDetermineCompilerFlags.cmake,v <-- vtkDetermineCompilerFlags.cmake
new revision: 1.6; previous revision: 1.5

 Issue History
Date Modified Username Field Change
2007-08-07 13:07 Sean McBride Assigned To Mathieu Malaterre => David Cole
2007-08-15 14:36 David Cole Note Added: 0008472
2007-08-15 14:38 David Cole Status tabled => @80@
2007-08-15 14:38 David Cole Resolution suspended => fixed
2008-02-07 11:36 Sean McBride Status @80@ => @20@
2008-02-07 11:36 Sean McBride Resolution fixed => reopened
2008-02-07 11:36 Sean McBride Note Added: 0010423
2008-02-25 11:13 Sean McBride Status @20@ => @80@
2008-02-25 11:13 Sean McBride Resolution reopened => fixed
2008-02-25 11:13 Sean McBride Note Added: 0010641
2008-02-25 11:13 Sean McBride Status @80@ => closed
2008-02-26 10:01 Sean McBride Assigned To David Cole => Sean McBride
2008-02-26 10:01 Sean McBride Status closed => @20@
2008-02-26 10:01 Sean McBride Resolution fixed => reopened
2008-02-26 10:01 Sean McBride Note Added: 0010649
2008-02-26 10:44 Sean McBride Note Added: 0010650
2008-02-26 10:44 Sean McBride Status @20@ => tabled
2008-02-26 10:44 Sean McBride Assigned To Sean McBride => David Cole
2008-02-26 15:55 Sean McBride Status tabled => @80@
2008-02-26 15:55 Sean McBride Resolution reopened => fixed
2008-02-26 15:55 Sean McBride Note Added: 0010651
2008-02-28 12:51 Sean McBride Status @80@ => closed
2008-09-25 08:22 Sean McBride Relationship added related to 0007734
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2018 MantisBT Team