This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpplib: command-line directive handling
- To: Neil Booth <NeilB at earthling dot net>
- Subject: Re: cpplib: command-line directive handling
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Fri, 10 Mar 2000 23:41:31 -0800
- Cc: gcc-patches at gcc dot gnu dot org
- References: <E12TgAs-00007a-00@monkey.rosenet.ne.jp>
On Sat, Mar 11, 2000 at 04:18:58PM +0900, Neil Booth wrote:
> This patch simplifies handling of command-line directives (-D, -U, -A
> and the unimplemented unassert option) by unifying their processing.
Good... I like patches that delete large chunks of code.
I remember intending to put in something with notation like
-A^foo(bar) or -A-foo(bar) or something, that did unassert. Looks
like it never actually happened.
Assertions are really just a nuisance - a pile of code that has to be
maintained, and the syntax uses shell metacharacters. I'd like to see
a patch that made -A (not #assert) take 'foo=bar' as well as
'foo(bar)' and changed all the tm.h files to match, so I could stop
having to edit gcc -v output before feeding it back to the shell.
> Also, the pending defines and asserts lists are merged. I reason this
> is safe since the only effect of them being separate was during
> registration: the defines list was looped through before the asserts
> list, but as their namespaces are distinct (macros cannot begin with
> #) mixing the two still-ordered lists should give the same result.
Yes, that should be fine. It was done with separate lists, IIRC,
mainly so I didn't have to have two flags in struct cpp_pending. Or
else it was something I inherited from the original implementation.
> Zack, possibly for the future: if the improved token-handling means
> that do_define and do_undef no longer require null-terminated strings,
> it will be possible to further eliminate cpp_define, cpp_undef,
> cpp_assert and cpp_unassert entirely and just call the do_define
> etc. handlers directly from cpp_start_read (between a cpp_push_buffer
> and cpp_pop_buffer).
I don't think this is feasible - cpp_define at least has to do quite a
bit of preprocessing. In any case, I want to preserve the interface
given by cpp_define et al for potential use outside the library, and I
don't want to expose any of the do_directive functions. I'm not
entirely sure cpp_(push,pop)_buffer should be visible either.
> GCC bootstraps with this. OK to commit?
Yes.
zw