|
Boost Users : |
Subject: Re: [Boost-users] wave: changing to relative paths in #line output?
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-03-17 18:47:50
> > There is no simple way to do so. But - depending on the urgency -
> this could
> > be made available to you. It would be a matter of moving the
> formatting of
> > the #line directives to a new preprocessor hook function, where you
> could
> > customize the format in any way you prefer.
>
> If you can point me to anything specific in the wave source, then I can
> write some code and test it. If not, I'll write my own code to
> post-process your #line output to get it back to a relative form.
>
> I think this would be a (very) good feature (as well as being
> gcc-compatible). It makes it easier to read compiler error messages
> when
> the source files are spread over several directories, and makes the
> messages more compact.
Well, if you want to hack it directly, there is a function called
pp_iterator_functor<>::emit_line_directive (see
wave/util/cpp_iterator.hpp:+732) doing what its name says.
> >> Or to make the output more gcc/cpp-compatible? There are a couple of
> other
> > minor
> >> differences to gcc and mcpp: wave produces '#line n', for example,
> and
> >> the others produce '# n'.
> >
> > What other differences do you have in mind?
>
> The only other difference I've noticed is that gcc always starts its
> output with a line directive for the first source file; you don't put
> in
> line directives until you need to. The gcc way is potentially useful,
> because the parser (or whoever gets the wave output) doesn't need to
> have its own independent knowledge of what the first source file was.
Hmmm, you have a point here. Emitting a #line directive on the first line
for the main file might be a good idea. Wave tries to minimize the output,
but this one #line directive wouldn't make things worse. I'll see what I can
do.
> > FWIW, the gcc way of formatting the line directives as '# n' is not
> > standards conformant. Actually, this output results in an illegal
> > preprocessing directive.
>
> Ah. Maybe some of the gcc people work for MS? :)
Shhh, don't say that too loudly! :-P
Regards Hartmut
---------------
Meet me at BoostCon
www.boostcon.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net