[Paraview-developers] interesting bug in vtkPVGeneratedModules.h

Wylie, Brian bnwylie at sandia.gov
Fri, 19 Dec 2003 16:28:49 -0700


So... lets see... I will try to explain this bug as well as I can...

My understanding is that files like reader.xml are processed, put into a
string(s) and put in vtkPVGeneratedModules.h... My recollection is that
after a while these files got so large that some string lengths were
exceeded.. so now they're put into multiple strings. Well I just noticed
that an interesting thing happens. If you have an #ifdef that is not defined
and it happens to be around a 'divide' location between strings than the
string declaration (when put into the vtkPVGeneratedModules.h) actually is
#ifdef'd out. So I get the following error.

C:\Work\vtk_stuff\ParaView\ParaView\vtkPVGeneratedModules.h(1847) : error
C2065: 'vtkPVInitializeStandardReadersInterfaces2' : undeclared identifier

I can avoid this error by simply moving around the modules in readers.xml.
Here's a code snippet from vtkPVGeneratedModules.h to demonstrate.

...

"  <LabeledToggle label=\"Block Ids\" variable=\"GenerateBlockIdCellArray\"
trace_name=\"block_ids\" help=\"Select whether the reader generates block
ids\" default_value=\"1\"/>\n"
"  <LabeledToggle label=\"Global Node Ids\"
variable=\"GenerateGlobalNodeIdArray\" trace_name=\"global_node_ids\"
help=\"Select whether the reader generates global node ids\"
default_value=\"1\"/>\n"
"  <LabeledToggle label=\"Global Element Ids\"
variable=\"GenerateGlobalElementIdArray\" trace_name=\"blobal_element_ids\"
help=\"Select whether the reader generates global element ids\"
default_value=\"0\"/>\n"
" </Module>\n"
"\n"
#endif // End of ifdef
"\n"
#ifdef PARAVIEW_USE_SAF
" <Module name=\"SAFReader\" root_name=\"SAFReader\" \n"
"    output=\"vtkUnstructuredGrid\" \n"
"    class=\"vtkPVAdvancedReaderModule\" module_type=\"Reader\"
extensions=\".saf\" \n"
"    file_description=\"SAF Reader\">\n"
;

// From file C:/Work/vtk_stuff/ParaView/ParaView/Resources/Readers.xml
static const char* vtkPVInitializeStandardReadersInterfaces2 =
"  <Source class=\"vtkSAFPVReader\"/>\n"
"\n"
"  <Scale variable=\"TimeStep\" type=\"int\" label=\"Time step\"
trace_name=\"TimeStep\"\n"
"    help=\"Set the current timestep.\" range_source=\"TimeStepRange\" />\n"
"\n"
"  <ArraySelection trace_name=\"variable_sel\" attribute_name=\"Variable\"
/>\n"
" \n"
"  <ArraySelection trace_name=\"block_sel\" attribute_name=\"Block\"  />\n"
" \n"
" </Module>\n"
"\n"
#endif // End of ifdef
...

So... you can see that the #ifdef is around the declaration of
vtkPVInitializeStandardReadersInterfaces2 and therefore
vtkPVInitializeStandardReadersInterfaces2  is never declared. :) 

	Brian Wylie
	Sandia National Laboratories
	MS 0822 - Org 9227 - Building 880/A1-J
     (505) 844-2238   FAX (505) 845-0833