public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* protos for warning(), error()
       [not found] <199803022124.QAA21167@caip.rutgers.edu>
@ 1998-03-03  6:56 ` Robert Lipe
       [not found]   ` <199803062059.MAA17836@rtl.cygnus.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Lipe @ 1998-03-03  6:56 UTC (permalink / raw)
  To: egcs

Many files call warning() and error().   Many file complain about the
absence of protos for those functions - and since those are vararg/stdarg
functions, this can actually represent a problem.

I found there used to be protos for them.

rtl.h:
	/* In toplev.c */
	extern void strip_off_ending            PROTO ((char *, int));
	extern void print_time                  PROTO ((char *, int));
	extern int get_run_time                 PROTO ((void));
	#if 0
	extern void fatal                       PVPROTO ((char *, ...));
	extern void warning                     PVPROTO ((char *, ...));
	extern void error                       PVPROTO ((char *, ...));
	#endif

tree.h:
	/* toplev.c */
	[ munch ] 
	extern void fatal_io_error              PROTO ((char *));
	#if 0
	extern void warning                     PVPROTO ((char *, ...));
	extern void error                       PVPROTO ((char *, ...));
	#endif
	extern void pedwarn                     PVPROTO ((char *, ...));


Does anyone have any idea why thre are #if 0'ed away.  How about why so
much of this stuff appears in at least two different files?  I can't
find any smoking gnus in ChangeLogs for either EGCS or GCC, but I didn't
scour them, either.

We like the GNU __attribute__ ((format (printf, ...))) stuff, don't we?
I think we've probably all been bitten by errors in these error message.

Does creation of a toplev.h that contains a single set of enhanced protos
for these things sound like the thing to do?  This file would be included
by the two aforementinoed ones and would include something like:

	#if __GNUC__
	#  proto it with __attribute__ stuff
	#else
	# use PVPROTO stuff.
	#endif

Is GNUC == true ANSI == false a useful combination? 


RJL

^ permalink raw reply	[flat|nested] 10+ messages in thread

* proposed patch: protos for warning(), error()
       [not found]   ` <199803062059.MAA17836@rtl.cygnus.com>
@ 1998-04-13 22:36     ` Robert Lipe
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Lipe @ 1998-04-13 22:36 UTC (permalink / raw)
  To: egcs; +Cc: egcs

On March 6, in response to my babbling about ways to prototype some things
in toplevel.c, Jim Wilson wrote:

> All front-end files include tree.h.  All back-end files include rtl.h.
> All middle-end files include one or both of them.  Thus you get fairly
> complete coverage by putting stuff in these two files.  This is convenient,
> but not the best design.  A toplev.h file would be better.

This turned out to be the key revelation to not having to touch every
file in this project to add '#include toplev.h' and not have to even
further uglify the makefile dependencies.   The fact that both of these
include gansidecl.h makes things even easier.

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.


I've bootstrapped C with this patch (C++ fails for other reasons already
discussed). Since it uses existing infrastructure, I don't expect this
to be any more of a portability hassle than the existing code. I haven't
picked through the call sites to address any warnings that are exposed
by this patch. It should make Kaveh's numbers less noisy with complaints
about warning() and error() not being protoed.

I expect this will be the source of some discussion, so I haven't really
prepared this in a "ready to be submitted" (i.e. no ChangeLog) form.  It's
really meant to be read by humans, not patch.

Comments, please.

RJL



/* toplev.h - Various declarations for functions found in toplev.c
   Copyright (C) 1998 Free Software Foundation, Inc.
 */

#ifndef __GCC_TOPLEV_H__
#define __GCC_TOPLEV_H__

extern void print_time			PROTO ((char *, int));
extern int get_run_time			PROTO ((void));
extern void debug_start_source_file	PROTO ((char *));
extern void debug_end_source_file	PROTO ((unsigned));
extern void debug_define		PROTO ((unsigned, char *));
extern void debug_undef			PROTO ((unsigned, char *));
extern void fatal			PVPROTO ((char *, ...))
						ATTRIBUTE_PRINTF_1;
extern void fatal_io_error		PROTO ((char *));
extern void warning			PVPROTO ((char *, ...))
						ATTRIBUTE_PRINTF_1;
extern void error			PVPROTO ((char *, ...))
						ATTRIBUTE_PRINTF_1;
extern void pedwarn			PVPROTO ((char *, ...))
						ATTRIBUTE_PRINTF_1;
extern void pedwarn_with_file_and_line	PVPROTO ((char *, int, char *, ...))
						ATTRIBUTE_PRINTF_3;
extern void warning_with_file_and_line	PVPROTO ((char *, int, char *, ...))
						ATTRIBUTE_PRINTF_3;
extern void error_with_file_and_line	PVPROTO ((char *, int, char *, ...))
						ATTRIBUTE_PRINTF_3;
extern void sorry			PVPROTO ((char *s, ...))
						ATTRIBUTE_PRINTF_1;
extern void default_print_error_function PROTO ((char *));
extern void report_error_function	PROTO ((char *));

/* 
 * If we weren't included via a tree.h, we don't know what a `tree' is.
 * Of course, if we don't know what a tree is, we aren't going to need 
 * these prototyped anyway.
 *
 */

#if defined TREE_OPERAND
extern void rest_of_decl_compilation	PROTO ((tree, char *, int, int));
extern void rest_of_type_compilation	PROTO ((tree, int));
extern void rest_of_compilation		PROTO ((tree));
extern void pedwarn_with_decl		PVPROTO ((tree, char *, ...));
extern void warning_with_decl		PVPROTO ((tree, char *, ...));
extern void error_with_decl		PVPROTO ((tree, char *, ...));
extern void announce_function		PROTO ((tree));
#endif /* TREE_OPERAND */


#endif /* __GCC_TOPLEV_H */


Index: Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/Makefile.in,v
retrieving revision 1.85
diff -u -p -r1.85 Makefile.in
--- Makefile.in	1998/04/10 00:31:10	1.85
+++ Makefile.in	1998/04/14 05:31:34
@@ -670,9 +670,9 @@ DPBIT_FUNCS = _pack_df _unpack_df _addsu
 # If it is, rm *.o is an easy way to do it.
 # CONFIG_H = $(host_xm_file) $(tm_file)
 CONFIG_H =
-RTL_BASE_H = rtl.h rtl.def gansidecl.h machmode.h machmode.def
+RTL_BASE_H = rtl.h rtl.def gansidecl.h toplev.h machmode.h machmode.def
 RTL_H = $(RTL_BASE_H) genrtl.h
-TREE_H = tree.h real.h tree.def gansidecl.h machmode.h machmode.def
+TREE_H = tree.h real.h tree.def gansidecl.h toplev.h machmode.h machmode.def
 BASIC_BLOCK_H = basic-block.h bitmap.h
 DEMANGLE_H = demangle.h gansidecl.h
 RECOG_H = recog.h gansidecl.h
Index: genrecog.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/genrecog.c,v
retrieving revision 1.9
diff -u -p -r1.9 genrecog.c
--- genrecog.c	1998/04/03 16:35:26	1.9
+++ genrecog.c	1998/04/14 05:31:48
@@ -188,7 +188,6 @@ static void change_state	PROTO((char *, 
 static char *copystr		PROTO((char *));
 static void mybzero		PROTO((char *, unsigned));
 static void mybcopy		PROTO((char *, char *, unsigned));
-static void fatal		PROTO((char *));
 char *xrealloc			PROTO((char *, unsigned));
 char *xmalloc			PROTO((unsigned));
 void fancy_abort		PROTO((void));
Index: rtl.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/rtl.h,v
retrieving revision 1.25
diff -u -p -r1.25 rtl.h
--- rtl.h	1998/04/11 00:28:07	1.25
+++ rtl.h	1998/04/14 05:31:55
@@ -172,6 +172,7 @@ typedef struct rtx_def
 } *rtx;
 
 #include "gansidecl.h"
+#include "toplev.h"
 
 #define NULL_RTX (rtx) 0
 
@@ -1288,22 +1289,6 @@ extern void expand_dec			PROTO ((rtx, rt
 extern rtx expand_mult_highpart		PROTO ((enum machine_mode, rtx,
 						unsigned HOST_WIDE_INT, rtx,
 						int, int));
-
-/* In toplev.c */
-extern void strip_off_ending		PROTO ((char *, int));
-extern void print_time			PROTO ((char *, int));
-extern int get_run_time			PROTO ((void));
-#if 0
-extern void fatal			PVPROTO ((char *, ...));
-extern void warning			PVPROTO ((char *, ...));
-extern void error			PVPROTO ((char *, ...));
-#endif
-extern void pfatal_with_name		PROTO ((char *));
-extern void fancy_abort			PROTO ((void));
-extern int count_error			PROTO ((int));
-extern void pedwarn			PVPROTO ((char *, ...));
-extern void warning_for_asm		PVPROTO ((rtx, char *, ...));
-extern void error_for_asm		PVPROTO ((rtx, char *, ...));
 
 /* In global.c */
 #ifdef BUFSIZ
Index: tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tree.h,v
retrieving revision 1.24
diff -u -p -r1.24 tree.h
--- tree.h	1998/04/13 11:38:16	1.24
+++ tree.h	1998/04/14 05:31:58
@@ -1225,6 +1225,8 @@ union tree_node
 \f
 #include "gansidecl.h"
 
+#include "toplev.h"
+
 #define NULL_TREE (tree) NULL
 
 /* The following functions accept a wide integer argument.  Rather than
@@ -2105,34 +2107,6 @@ extern void fixup_signed_type		PROTO ((t
 extern void make_decl_rtl		PROTO ((tree, char *, int));
 extern void make_decl_one_only		PROTO ((tree));
 extern void variable_section		PROTO ((tree, int));
-
-/* toplev.c */
-extern void print_time			PROTO ((char *, int));
-extern int get_run_time			PROTO ((void));
-extern void debug_start_source_file	PROTO ((char *));
-extern void debug_end_source_file	PROTO ((unsigned));
-extern void debug_define		PROTO ((unsigned, char *));
-extern void debug_undef			PROTO ((unsigned, char *));
-extern void rest_of_decl_compilation	PROTO ((tree, char *, int, int));
-extern void rest_of_type_compilation	PROTO ((tree, int));
-extern void rest_of_compilation		PROTO ((tree));
-extern void fatal			PVPROTO ((char *, ...));
-extern void fatal_io_error		PROTO ((char *));
-#if 0
-extern void warning			PVPROTO ((char *, ...));
-extern void error			PVPROTO ((char *, ...));
-#endif
-extern void pedwarn			PVPROTO ((char *, ...));
-extern void pedwarn_with_decl		PVPROTO ((tree, char *, ...));
-extern void pedwarn_with_file_and_line	PVPROTO ((char *, int, char *, ...));
-extern void warning_with_file_and_line	PVPROTO ((char *, int, char *, ...));
-extern void warning_with_decl		PVPROTO ((tree, char *, ...));
-extern void error_with_decl		PVPROTO ((tree, char *, ...));
-extern void error_with_file_and_line	PVPROTO ((char *, int, char *, ...));
-extern void sorry			PVPROTO ((char *s, ...));
-extern void default_print_error_function PROTO ((char *));
-extern void report_error_function	PROTO ((char *));
-extern void announce_function		PROTO ((tree));
 
 /* In fold-const.c */
 extern int div_and_round_double		PROTO ((enum tree_code, int,


-- 
Robert Lipe       http://www.dgii.com/people/robertl       robertl@dgii.com
              (WEB ADDRESS MAY BE TEMPORARILY UNAVAILABLE)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: proposed patch: protos for warning(), error()
  1998-04-15  9:32 Kaveh R. Ghazi
  1998-04-15 13:12 ` Robert Lipe
@ 1998-04-15 16:09 ` Jeffrey A Law
  1 sibling, 0 replies; 10+ messages in thread
From: Jeffrey A Law @ 1998-04-15 16:09 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: robertl, rth, egcs

  In message < 199804151508.LAA02991@caip.rutgers.edu >you write:
  > 	I'm not liking the ugliness factor here.  Let's not jump
  > through too many hoops and introduce too many oddities just to avoid
  > some one time editing.
Right.

  > 	I suggest that we "do the right thing".  I.e. include toplev.h
  > only in those files which use one or more of the relevant functions,
  > which link with toplev.o, and after including rtl.h/tree.h so we get
  > the proper definition for `tree'.
I'd tend to agree.  Let's try and do this right so that we don't
end up having to live with a wart later -- there's far too many
in the compiler already.

jeff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: proposed patch: protos for warning(), error()
  1998-04-15  9:32 Kaveh R. Ghazi
@ 1998-04-15 13:12 ` Robert Lipe
  1998-04-15 16:09 ` Jeffrey A Law
  1 sibling, 0 replies; 10+ messages in thread
From: Robert Lipe @ 1998-04-15 13:12 UTC (permalink / raw)
  To: Kaveh R. Ghazi, rth; +Cc: egcs

> 	I'm not liking the ugliness factor here.  Let's not jump
> through too many hoops and introduce too many oddities just to avoid
> some one time editing.

What we now have isn't too horrible.

> 	If you examine the current prototypes in tree.h/rtl.h, they
> already have much of the contents of the proposed toplev.h file except
> that fatal/error/warning are #ifdef'ed out.  I think this is because
> of the exact reason I gave regarding the conflicts with static copies
> of `fatal'.  Let's not enshrine this problem.

The pertinent part of one of those two files became toplev.h.

> 	I suggest that we "do the right thing".  I.e. include toplev.h
> only in those files which use one or more of the relevant functions,

It's drudgery I was hoping to avoid.    If we get a consensus that this
is the right thing to do, I'll do it.

I'm not unhappy with toplev.h as it now stands after rth's suggestions.

RJL

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: proposed patch: protos for warning(), error()
@ 1998-04-15  9:32 Kaveh R. Ghazi
  1998-04-15 13:12 ` Robert Lipe
  1998-04-15 16:09 ` Jeffrey A Law
  0 siblings, 2 replies; 10+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-15  9:32 UTC (permalink / raw)
  To: robertl, rth; +Cc: egcs

 > From: Robert Lipe <robertl@dgii.com>
 > 
 > > Ug and ug.
 > 
 > "Ug"reed. :-)
 > 
 > > You should just use `union tree_node *' in place of `tree'.  C does let
 > 
 > Oooh.  I just made my first visit to tree.h.  I didn't realize the
 > definition of 'tree' was so simple.
 > 
 > I just implemented your idea.   Thanx!
 > 
 > I plan to just stick in good ideas as they roll in, then submit a "for
 > approval" patch when the dust settles.
 > 
 > > you leave structures undefined.  You would of course want a `union tree_node;'
 > > just before the definitions to avoid the warning about not being declared.
 > 
 > Actually, since toplev.h is included in tree.h after tree_node is
 > declared, this isn't necessary.
 > 
 > Is this too fragile?   
 > RJL


	I'm not liking the ugliness factor here.  Let's not jump
through too many hoops and introduce too many oddities just to avoid
some one time editing.


	If you examine the current prototypes in tree.h/rtl.h, they
already have much of the contents of the proposed toplev.h file except
that fatal/error/warning are #ifdef'ed out.  I think this is because
of the exact reason I gave regarding the conflicts with static copies
of `fatal'.  Let's not enshrine this problem.


	I suggest that we "do the right thing".  I.e. include toplev.h
only in those files which use one or more of the relevant functions,
which link with toplev.o, and after including rtl.h/tree.h so we get
the proper definition for `tree'.

	Yes, this involves more editing of .c files and Makefile.in,
but I'll volunteer to do it if Robert doesn't want to.

		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		Icon CMT Corp.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: proposed patch: protos for warning(), error()
@ 1998-04-15  7:39 Kaveh R. Ghazi
  0 siblings, 0 replies; 10+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-15  7:39 UTC (permalink / raw)
  To: robertl; +Cc: egcs

 > From: Robert Lipe <robertl@dgii.com>
 > 
 > > 	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.

	Yes it is kinda big.  I looked and toplev.o gets to around
200k-350k depending on your platform. 


 > 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.
 > RJL

	No I don't think we need a fatal.c.

		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		Icon CMT Corp.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: proposed patch: protos for warning(), error()
  1998-04-14 11:44 ` Robert Lipe
@ 1998-04-15  2:25   ` Richard Henderson
  1998-04-14 23:16     ` Robert Lipe
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 1998-04-15  2:25 UTC (permalink / raw)
  To: Robert Lipe; +Cc: Kaveh R. Ghazi, egcs

On Tue, Apr 14, 1998 at 10:50:24AM -0500, Robert Lipe wrote:
> > 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__ */

Ug and ug.

You should just use `union tree_node *' in place of `tree'.  C does let
you leave structures undefined.  You would of course want a `union tree_node;'
just before the definitions to avoid the warning about not being declared.


r~

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: proposed patch: protos for warning(), error()
  1998-04-15  2:25   ` Richard Henderson
@ 1998-04-14 23:16     ` Robert Lipe
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Lipe @ 1998-04-14 23:16 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Kaveh R. Ghazi, egcs

Richard Henderson wrote:
> On Tue, Apr 14, 1998 at 10:50:24AM -0500, Robert Lipe wrote:

[ some babbling with a slightly misguided idea for toplev.h ] 

> Ug and ug.

"Ug"reed. :-)

> You should just use `union tree_node *' in place of `tree'.  C does let

Oooh.  I just made my first visit to tree.h.  I didn't realize the
definition of 'tree' was so simple.

I just implemented your idea.   Thanx!

I plan to just stick in good ideas as they roll in, then submit a "for
approval" patch when the dust settles.

> you leave structures undefined.  You would of course want a `union tree_node;'
> just before the definitions to avoid the warning about not being declared.

Actually, since toplev.h is included in tree.h after tree_node is
declared, this isn't necessary.

Is this too fragile?   

RJL

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re:  proposed patch: protos for warning(), error()
@ 1998-04-14 13:21 Kaveh R. Ghazi
  1998-04-14 11:44 ` Robert Lipe
  0 siblings, 1 reply; 10+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-14 13:21 UTC (permalink / raw)
  To: robertl; +Cc: egcs

 > From: Robert Lipe <robertl@dgii.com>
 > 
 > On March 6, in response to my babbling about ways to prototype some things
 > in toplevel.c, Jim Wilson wrote:
 > 
 > > All front-end files include tree.h.  All back-end files include rtl.h.
 > > All middle-end files include one or both of them.  Thus you get fairly
 > > complete coverage by putting stuff in these two files.  This is convenient,
 > > but not the best design.  A toplev.h file would be better.
 > 
 > This turned out to be the key revelation to not having to touch every
 > file in this project to add '#include toplev.h' and not have to even
 > further uglify the makefile dependencies.   The fact that both of these
 > include gansidecl.h makes things even easier.
 > 
 > 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.
 > 
 > 
 > I've bootstrapped C with this patch (C++ fails for other reasons already
 > discussed). Since it uses existing infrastructure, I don't expect this
 > to be any more of a portability hassle than the existing code. I haven't
 > picked through the call sites to address any warnings that are exposed
 > by this patch. It should make Kaveh's numbers less noisy with complaints
 > about warning() and error() not being protoed.
 > 
 > I expect this will be the source of some discussion, so I haven't really
 > prepared this in a "ready to be submitted" (i.e. no ChangeLog) form.  It's
 > really meant to be read by humans, not patch.
 > 
 > Comments, please.
 > 
 > RJL



	Great work Robert.  I have two concerns about implementation
with respect to using rtl.h and tree.h.

	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
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?


	The second issue is about the so called "middle-end" files which
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,
varasm.c, function.c and a few other places.) Its obviously not hard to
correct when we notice it, but it introduces a maintenance headache and
I was wondering if there is an easy way to zap this minor problem in
some clean automated fashion.  (Moving the stuff wrapped by TREE_OPERAND
outside the header file wrapper didn't seem clean, but it would work...)

		--Kaveh


 > /* toplev.h - Various declarations for functions found in toplev.c
 >    Copyright (C) 1998 Free Software Foundation, Inc.
 >  */
 > 
 > #ifndef __GCC_TOPLEV_H__
 > #define __GCC_TOPLEV_H__
 > 
 > [...]
 > 
 > /* 
 >  * If we weren't included via a tree.h, we don't know what a `tree' is.
 >  * Of course, if we don't know what a tree is, we aren't going to need 
 >  * these prototyped anyway.
 >  *
 > 
 > #if defined TREE_OPERAND
 > extern void rest_of_decl_compilation	PROTO ((tree, char *, int, int));
 > extern void rest_of_type_compilation	PROTO ((tree, int));
 > extern void rest_of_compilation		PROTO ((tree));
 > extern void pedwarn_with_decl		PVPROTO ((tree, char *, ...));
 > extern void warning_with_decl		PVPROTO ((tree, char *, ...));
 > extern void error_with_decl		PVPROTO ((tree, char *, ...));
 > extern void announce_function		PROTO ((tree));
 > #endif /* TREE_OPERAND */
 > 
 > 
 > #endif /* __GCC_TOPLEV_H */
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		Icon CMT Corp.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: proposed patch: protos for warning(), error()
  1998-04-14 13:21 Kaveh R. Ghazi
@ 1998-04-14 11:44 ` Robert Lipe
  1998-04-15  2:25   ` Richard Henderson
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Lipe @ 1998-04-14 11:44 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1998-04-15 16:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199803022124.QAA21167@caip.rutgers.edu>
1998-03-03  6:56 ` protos for warning(), error() Robert Lipe
     [not found]   ` <199803062059.MAA17836@rtl.cygnus.com>
1998-04-13 22:36     ` proposed patch: " Robert Lipe
1998-04-14 13:21 Kaveh R. Ghazi
1998-04-14 11:44 ` Robert Lipe
1998-04-15  2:25   ` Richard Henderson
1998-04-14 23:16     ` Robert Lipe
1998-04-15  7:39 Kaveh R. Ghazi
1998-04-15  9:32 Kaveh R. Ghazi
1998-04-15 13:12 ` Robert Lipe
1998-04-15 16:09 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).