Dear Brad / list,

Long story short, I thought I'd have a go at upgrading GCCXML's backend compiler to GCC4.7.2. I made a fork on github a week ago and have been working on it since.

I initially thought that there was no chance of me getting it to work, but I stuck at it and have had some joy, sort of. Parse-able XML output is being dumped, but there are some errors reported by the backend compiler. gccxml_cc1plus exits with code 1, and gccxml assumes that it seg-faulted, so all the ctests currently fail..

The last error I've come across has stumped me.. When looking for a solution online, I found a thread in this mailing list (http://public.kitware.com/pipermail/gccxml/2008-April/001100.html), where you resolved the issue within 24 hours - Kudos for that Brad!

On github, I found the commit to workaround this:
https://github.com/gccxml/gccxml/commit/36c88f006a8e81261e637869b985332308ac99dd

But tbh, I don't have a clue how to implement a similar fix for GCC 4.7.2.

The tracebacks only seem to show include lines and errors within system headers, which is new to me and makes debugging it a problem...

For example:

In file included from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43:0, from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40, from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
                 from ../GCC_XML/GXFront/gxSystemTools.h:29,
                 from ../GCC_XML/GXFront/gxConfiguration.h:20,
                 from ../GCC_XML/Testing/TestUsualInclude.cxx:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:791:5: error: 'std::ios_base& std::ios_base::operator=(const std::ios_base&)' is private In file included from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:45:0, from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40, from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
                 from ../GCC_XML/GXFront/gxSystemTools.h:29,
                 from ../GCC_XML/GXFront/gxConfiguration.h:20,
                 from ../GCC_XML/Testing/TestUsualInclude.cxx:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_ios.h:64:11: error: within this context In file included from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:41:0,
                 from ../GCC_XML/GXFront/gxSystemTools.h:29,
                 from ../GCC_XML/GXFront/gxConfiguration.h:20,
                 from ../GCC_XML/Testing/TestUsualInclude.cxx:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/istream: In member function 'std::basic_istream<char>& std::basic_istream<char>::operator=(const std::basic_istream<char>&)': /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/istream:56:11: note: synthesized method 'std::basic_ios<char>& std::basic_ios<char>::operator=(const std::basic_ios<char>&)' first required here


--------------------------------


There are similar errors with std::basic_ofstream, std::basic_streambuf, std::locale::facet, std::num_put, and std::ctype. All giving errors about copy constructors on private members.

I suspect this has to do with a change in the C++03 standard, judging by this answer on SO: http://stackoverflow.com/a/9123195/566098

If you could suggest on which files I should direct my efforts, I'll do my best to resolve this. Any help would be really appreciated! Otherwise, I'll spend some time grep'ing and preprocessing various source files.. Any ideas?

--------------------------------

Changes I made are in a fork of your repo on github, hosted at https://github.com/alexleach/gccxml/

The changes are split over a few commits, as changing the GCC code affected almost 3,000 files, so I dumped that in a single commit and any manual edits and patches were committed afterwards. Should have probably started a branch...

Most of the work involved editing the CMake build system files. I saw that you're a core CMake maintainer, so I apologise if my edits aren't up to your usual standards!

---------------------------------

Unrelated to these issues, but thinking about moving forward.. Richard Guenther - one of the lead maintainers of the GCC project - suggested to me on IRC the other day that I might try and turn it into a plugin...

Plugins seem to be compatible with GCC versions 4.5 and up. I thought it sounds like a good idea, in that it would hopefully drop the need for a lot of the support headers; I imagine it should reduce future maintenance; the binary is much smaller; and obviously compiling a dynamically loaded plugin is much, much quicker than recompiling a large chunk of GCC.

So after getting the above issues - which I think are totally resolvable - I started working on patching xml.c to become a plugin. Obviously there's some issues with the global variables and functions patched into other modules, like in method.c, decl2.c and diagnostic.c, but the hard part is already done; you did it years ago!

I should probably create a fork for the plugin, but so far, I've just created a new sub-project (GCC/gccxml-plugin) in which I'm hacking xml.c in an attempt to turn it into a plugin. Still quite a lot of work to do; I'm a noob with C and C++ so progress is slow, but I'm learning a lot! Would also need to modify the gccxml driver to instead invoke g++, also passing it different arguments; i.e: '-fplugin=libgccxml_plugin.so -fplugin-libgccxml_plugin-xml=... -fplugin-libgccxml_plugin-xml_start=...'


---------

Thanks for reading this! I was indenting on submitting a Pull Request at some point, but I feel like I've made a mess of what was beautiful code and a clean version history, so maybe it's best left as a separate fork..

If you would be interested in merging any of it back into the main repository, please let me know and I'll make a Pull Request. I think I should get it working first, though...

One last thing worth mentioning. I had a look at the other fork, by Andrej Mitrovic, and incorporated some of his feature additions, like putting C++ attributes into XML tags and detection of Pod, Anon and TypeScoped C++ Types.

Yours sincerely,
Alex
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.gccxml.org/mailman/listinfo/gccxml

Reply via email to