public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robert Lipe <robertl@dgii.com>
To: egcs@cygnus.com
Cc: egcs@cygnus.com
Subject: proposed patch: protos for warning(), error()
Date: Mon, 13 Apr 1998 22:36:00 -0000	[thread overview]
Message-ID: <19980414003637.B10938@dgii.com> (raw)
In-Reply-To: <199803062059.MAA17836@rtl.cygnus.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



/* 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)

  parent reply	other threads:[~1998-04-13 22:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199803022124.QAA21167@caip.rutgers.edu>
1998-03-03  6:56 ` Robert Lipe
     [not found]   ` <199803062059.MAA17836@rtl.cygnus.com>
1998-04-13 22:36     ` Robert Lipe [this message]
1998-04-14 13:21 proposed patch: " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980414003637.B10938@dgii.com \
    --to=robertl@dgii.com \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).