[GCC-XML] gccxml strange preprocessor bug

Neal Becker ndbecker2 at gmail.com
Sun May 14 15:11:19 EDT 2006


Looks like gccxml bug with preprocessor

gcc -dD -fsyntax-only -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" 
"/usr/local/src/boost.cvs/libs/random/random_test.cpp" -E > stuff


/usr/bin/gccxml -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" 
"/usr/local/src/boost.cvs/libs/random/random_test.cpp" 
-fxml="/usr/local/src/pygccxml/pyplusplus_dev/examples/pyboost_dev/pyboost/random/generated/random_test.xml" 
-E > stuff2

Now look at stuff:
void
compiler_log_formatter::log_build_info( std::ostream& output )
{
    output << "Platform: " << "linux" << '\n'
            << "Compiler: " << "GNU C++ version " "4.1.0 20060304 (Red Hat 
4.1.0-3)" << '\n'
            << "STL     : " << "GNU libstdc++ version " "20060304" << '\n'
            << "Boost   : " << 103400/100000 << "."
                            << 103400/100 % 1000 << "."
                            << 103400 % 100 << std::endl;
}

And here's stuff2:
void
xml_log_formatter::log_build_info( std::ostream& ostr )
{
    ostr << "<BuildInfo"
            << " platform" << attr_value() << "linux"
            << " compiler" << attr_value() << "GCC-XML C++ version " 700
            << " stl" << attr_value() << "GNU libstdc++ version " "20060304"
            << " boost=\"" << 103400/100000 << "."
                            << 103400/100 % 1000 << "."
                            << 103400 % 100 << '\"'
            << "/>";
}

No, I did NOT type those extra characters, they are in the gccxml cpp output.  
I also did not change STL to stl or Boost to boost=\

Now, believe it or not (I tried it twice!), if I just add '-dD' to gccxml 
command, now it looks OK:
/usr/bin/gccxml -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" 
"/usr/local/src/boost.cvs/libs/random/random_test.cpp" 
-fxml="/usr/local/src/pygccxml/pyplusplus_dev/examples/pyboost_dev/pyboost/random/generated/random_test.xml" 
-dD -E > stuff2
void
compiler_log_formatter::log_build_info( std::ostream& output )
{
    output << "Platform: " << "linux" << '\n'
            << "Compiler: " << "GCC-XML C++ version " 700 << '\n'
            << "STL     : " << "GNU libstdc++ version " "20060304" << '\n'
            << "Boost   : " << 103400/100000 << "."
                            << 103400/100 % 1000 << "."
                            << 103400 % 100 << std::endl;
}



More information about the gccxml mailing list