This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

One warning less: declaration of cp_printer



Compiling the curren gcc I got the following error:
/var/home/aj/cvs/gcc/gcc/cp/error.c:93: warning: function declaration isn't a prototype

A grep for cp_printer showed the following:

errfn.c:29:/* cp_printer is the type of a function which converts an argument into
errfn.c:30:   a string for digestion by printf.  The cp_printer function should deal
errfn.c:34:typedef const char *cp_printer PARAMS ((tree, int));
errfn.c:35:extern cp_printer * cp_printers[256];
errfn.c:76:      cp_printer * function;
errfn.c:106:      function = cp_printers[(int)*f];
error.c:93:typedef const char *cp_printer ();

IMO we should move the typedef and the extern into an include file.
Is cp-tree.h the right file to use?  Here's a patch, I've bootstrapped
on linux/i686.

Andreas

2000-09-20  Andreas Jaeger  <aj@suse.de>

	* errfn.c: Move declaration of cp_printer and cp_printers to ...
	* cp-tree.h: ... here.

	* error.c: Remove declaration of cp_printer.

============================================================
Index: gcc/cp/errfn.c
--- gcc/cp/errfn.c	2000/02/26 20:15:45	1.28
+++ gcc/cp/errfn.c	2000/09/20 12:32:27
@@ -26,14 +26,6 @@
 #include "cp-tree.h"
 #include "toplev.h"
 
-/* cp_printer is the type of a function which converts an argument into
-   a string for digestion by printf.  The cp_printer function should deal
-   with all memory management; the functions in this file will not free
-   the char*s returned.  See error.c for an example use of this code.  */
-
-typedef const char *cp_printer PARAMS ((tree, int));
-extern cp_printer * cp_printers[256];
-
 /* Whether or not we should try to be quiet for errors and warnings; this is
    used to avoid being too talkative about problems with tentative choices
    when we're computing the conversion costs for a method call.  */
============================================================
Index: gcc/cp/cp-tree.h
--- gcc/cp/cp-tree.h	2000/09/19 03:26:11	1.531
+++ gcc/cp/cp-tree.h	2000/09/20 12:32:37
@@ -4019,6 +4019,13 @@
 extern int cp_line_of				PARAMS ((tree));
 extern const char *language_to_string           PARAMS ((enum languages, int));
 extern void print_instantiation_context         PARAMS ((void));
+/* cp_printer is the type of a function which converts an argument into
+   a string for digestion by printf.  The cp_printer function should deal
+   with all memory management; the functions in errfn will not free
+   the char*s returned.  See error.c for an example use of this code.  */
+typedef const char *cp_printer 			PARAMS ((tree, int));
+extern cp_printer *cp_printers[256];
+
 
 /* in except.c */
 extern void init_exception_processing		PARAMS ((void));
============================================================
Index: gcc/cp/error.c
--- gcc/cp/error.c	2000/09/12 09:10:28	1.133
+++ gcc/cp/error.c	2000/09/20 12:32:39
@@ -90,8 +90,6 @@
      put_whitespace (TFI) = none;            \
    } while (0)
 
-typedef const char *cp_printer ();
-
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]