proposed patch: protos for warning(), error()

Robert Lipe robertl@dgii.com
Tue Apr 14 11:44:00 GMT 1998


Kaveh R. Ghazi wrote:
>  > From: Robert Lipe <robertl@dgii.com>

>  > It turns out all the plumbing is already present. If you just make
>  > create a toplev.h and force tree.h and rtl.h to include it (and deal
>  > with a slight bit of ugliness in doing so) and patch two lines in
>  > Makefile.in it's entirely possible to get this coverage with a very
>  > small amount of actual work.
> 
> 	Great work Robert.  I have two concerns about implementation
> with respect to using rtl.h and tree.h.

Thanx.  I'd hoped you'd comment.

> 	The first question is about files which don't link against
> toplev.o but do include one of rtl.h or tree.h.  For example, gen*.c
> includes rtl.h.  These files supply their own static copy of `fatal',
> and don't get it from toplev.c.  Right now, I don't think the intended

Ick.  Good point.

> functionality is too different between these `fatal' functions, but
> its still not clean to declare a function extern in a header
> supposedly to get it from toplev.o and then define a copy statically
> in the local module.

> 	I guess we could eliminate the local copy and link gen*.c and
> wherever else this comes up against toplev.o.  Does this make sense to
> do given the intended purpose of toplev.c?

In doing that, we'll end up sucking in a whole bunch of stuff from
toplev.c that we don't need.  Being an embedded systems guy, I'm really
grouchy about code size.

I'd come closer to stomaching a move of fatal() into fatal.c.  Of
course, when we do that, having the proto in toplev.h doesn't make
sense.


Actually, if we pick up toplev.h in gen*.c and snare the proto for
fatal() from there, we'll get the typechecking for the fatal in gen*.c.
If ever the arg list differs for fatal() etween the two declarations,
we'll see fireworks.  This seems unlikely, but possible.   So I guess
I'm not finding this problem to be too terrible.   Unsightly?  Yes.

It still seemed less painful that manually including it in all the
places that needed it.   Am I being an enabler?   Probably.

> include both tree.h and rtl.h.  If rtl.h is included first then, because
> of the fact that toplev.h is macro wrapped against multiple inclusion (a
> good thing IMHO), you'll never get the prototypes for the stuff wrapped
> by TREE_OPERAND.  (A quick glance shows this occurs in c-lex.c,
> ...
> some clean automated fashion.  (Moving the stuff wrapped by TREE_OPERAND
> outside the header file wrapper didn't seem clean, but it would work...)

Or we could move that stuff into a wrapper of its own.

#ifndef __GCC_TOPLEV_H_NOTREE__
#define __GCC_TOPLEV_H_NOTREE__
	voodoo protos from rtl.h
#endif /* __GCC_TOPLEV_H_NOTREE__ */

#ifndef __GCC_TOPLEV_H_TREE__
#define __GCC_TOPLEV_H_TREE__
	voodoo protos from tree.h
#endif /* __GCC_TOPLEV_H_TREE__ */


RJL



More information about the Gcc mailing list