On Fri, Oct 29, 2010 at 4:21 PM, Ian Lance Taylor <i...@google.com> wrote: > Artem Shinkarov <artyom.shinkar...@gmail.com> writes: > >> That is why now I want to use a gcc code-base for solving the same >> task. And the main problem for me at the moment is to build a cpp >> binary which would be able to handle options for preprocessor but >> which would not pull so many code from middleend and backend. In other >> words I want to have a separate binary for cpp. > > Why? > > I concede that the fact that cpp invokes the whole compiler is a bit > ugly and perhaps slightly inefficient. But it's not all that bad and it > does work today. The goals of your project seem entirely separable from > the goal of having a single cpp binary.
Yes, you are right the goals are of course separable but my concern is the following. All that I want to implement is a different behaviour for handling conditional an macros. So basically all the modifications are on the side of cpplib. Now when I want to have an interface for that for just giving a file to the cpplib I end up with a 40 MB binary (instead of 2 MB) and the most of the code will never be used. Another thing is when I'll have a modified version of cpplib which is going to be interfaces with c_parser and c-typeck, ... I'll have to put the same files with small modifications in a single front-end directory. The code would be doubled and the synchronization will be broken. So this way seems very ugly to me. On the other hand, cpp by its nature does not have to do anything with the internals of C. I mean that preprocessor should not care what kid of code it preprocesses. So my idea is to create just a light version of cpp binary. I'm not saying that we need to replace an existing approach of preprocessing used in gcc (cpp is basically "gcc -E"). I'm just saying that it could be a nice thing to have. I am ready to do that in terms of my project, but I need some help because I don't know all the internal secrets and features. So I ask for help in the design of such a thing. Of course if it does not sound like an absolutely useless. > > Ian > Artem Shinkarov