LWN.net Logo

GCC unplugged

GCC unplugged

Posted Nov 20, 2007 14:28 UTC (Tue) by Nelson (subscriber, #21712)
In reply to: GCC unplugged by JamesErik
Parent article: GCC unplugged

What are some meaningful tasks people are doing with GCC-XML? I always thought it was more about providing information as to the internal state of the compiler, not providing a new IR to perform analysis on and inject back in to the compiler. Almost like something an IDE might use. That's a substantially different goal than letting someone inject XML back in to GCC. What are all these XML tools that are supposed to do that in a good way also? I have seen a lot of parsers but not a lot of tools that can do the sorts of things you need to do to IR.

The whole plug-in thing is sexy in a way, you always have a tool to solve the problems you didn't think about or don't want to solve. It's astonishingly difficult to do well though, eclipse is an example of something built with that in mind and if you use a good sized set of plugins, you're always screwed when they roll the version of eclipse. There is a certain cost you have to put in to a project to get in merged in, with a plugin, that cost is lower and the likelihood that you'll abandon the code is higher, I think it's very common for "plugins" to be abandoned. The thing is, in a healthy open source project, it's alive and on going, you have access to the code and can change it to fix those unseen problems.

GCC front ends makes sense, and it's possible. If you play by the right rules, you can get your front-end incorporated in to the compiler distribution (D, Modula-3, Pascal are examples of them not doing that, and look at where they are now...) As for code generation and optimization, why wouldn't you want that included in the compiler?

The big thing is if you want to play with GCC you have to be a team player, there are rules to follow, you can't just hack out some code, throw it out and expect the GCC guys to jump on it, clean it up and incorporate it. These discussions always revolve around people following the community rules, look are Reiserfs 4, same issue, it's not like Linus and company didn't want it in, Hans just wouldn't/couldn't follow the rules.


(Log in to post comments)

GCC unplugged

Posted Nov 20, 2007 15:07 UTC (Tue) by dcoutts (subscriber, #5387) [Link]

What are some meaningful tasks people are doing with GCC-XML?

FFI tools for other high level languages. For example c2hs is a tool that reads .h files and generates Haskell code that imports the foreign C functions at the correct type. This guarantees cross-language type safety which is a pretty big deal.

At the moment c2hs has to use it's own hand-written C parser that understands all the GNU C extensions. This was not easy to make and it's not easy to maintain. Having a proper intermediate format generated by gcc would allow us to parse GNU C code easily and providing additional things like correct calculation of sizes of C types etc.

GCC unplugged

Posted Nov 20, 2007 18:11 UTC (Tue) by aleXXX (subscriber, #2742) [Link]

> What are some meaningful tasks people are doing with GCC-XML? 

Kitware (the CMake developers) wrote it and I think they use it to 
generate bindings to scripting languages for their libraries.

Alex

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds