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]

Prototype patch for lang_identify and print_error_function


	This patch adds a global prototype for print_error_function()
in tree.h.  The language front ends linking with toplev.c must provide
its definition, and this patch allows cleaning up local copies of the
prototype.  In the process, I const-ified both print_error_function()
and lang_identify() which necessitated complementary changes in the
language subdirs.

	Tested by bootstrapping on Irix6.  Okay to install?

		--Kaveh


1999-08-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* tree.h (lang_identify): Constify a char*.
	(print_error_function): Add extern prototype.  Constify a char*.

	* c-lang.c (lang_identify): Constify a char*.

	* objc/objc-act.c (lang_identify): Constify a char*.

diff -rup orig/egcs-CVS19990808/gcc/tree.h egcs-CVS19990808/gcc/tree.h
--- orig/egcs-CVS19990808/gcc/tree.h	Sun Aug  1 15:41:38 1999
+++ egcs-CVS19990808/gcc/tree.h	Sun Aug  8 11:44:37 1999
@@ -2076,7 +2076,11 @@ extern void lang_init				PROTO((void));
 extern void lang_finish				PROTO((void));
 
 /* Function to identify which front-end produced the output file. */
-extern char *lang_identify			PROTO((void));
+extern const char *lang_identify			PROTO((void));
+
+/* Called by report_error_function to print out function name.
+ * Default may be overridden by language front-ends.  */
+extern void (*print_error_function) PROTO((const char *));
 
 /* Function to replace the DECL_LANG_SPECIFIC field of a DECL with a copy.  */
 extern void copy_lang_decl			PROTO((tree));
diff -rup orig/egcs-CVS19990808/gcc/c-lang.c egcs-CVS19990808/gcc/c-lang.c
--- orig/egcs-CVS19990808/gcc/c-lang.c	Wed Jul 21 15:41:23 1999
+++ egcs-CVS19990808/gcc/c-lang.c	Sun Aug  8 11:38:11 1999
@@ -75,7 +75,7 @@ lang_finish ()
 {
 }
 
-char *
+const char *
 lang_identify ()
 {
   return "c";
diff -rup orig/egcs-CVS19990808/gcc/objc/objc-act.c egcs-CVS19990808/gcc/objc/objc-act.c
--- orig/egcs-CVS19990808/gcc/objc/objc-act.c	Tue Jul 20 07:47:53 1999
+++ egcs-CVS19990808/gcc/objc/objc-act.c	Sun Aug  8 11:41:46 1999
@@ -682,7 +682,7 @@ lang_finish ()
 {
 }
 
-char *
+const char *
 lang_identify ()
 {
   return "objc";


1999-08-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* actions.c (lang_identify): Constify a char*.

	* lang.c (chill_print_error_function): Likewise.
	(lang_init): Remove redundant prototype for `print_error_function'.

diff -rup orig/egcs-CVS19990808/gcc/ch/actions.c egcs-CVS19990808/gcc/ch/actions.c
--- orig/egcs-CVS19990808/gcc/ch/actions.c	Tue May  4 16:01:11 1999
+++ egcs-CVS19990808/gcc/ch/actions.c	Sun Aug  8 11:42:07 1999
@@ -64,7 +64,7 @@ extern char *dump_base_name;
    grant file written, generating no code. */
 int grant_only_flag = 0;
 
-char *
+const char *
 lang_identify ()
 {
   return "chill";
diff -rup orig/egcs-CVS19990808/gcc/ch/lang.c egcs-CVS19990808/gcc/ch/lang.c
--- orig/egcs-CVS19990808/gcc/ch/lang.c	Mon Jan 11 08:17:25 1999
+++ egcs-CVS19990808/gcc/ch/lang.c	Sun Aug  8 11:48:53 1999
@@ -236,7 +236,7 @@ lang_decode_option (argc, argv)
 
 void
 chill_print_error_function (file)
-     char *file;
+     const char *file;
 {
   static tree last_error_function = NULL_TREE;
   static struct module *last_error_module = NULL;
@@ -283,8 +283,6 @@ incomplete_type_error (value, type)
 void
 lang_init ()
 {
-  extern void (*print_error_function) PROTO((char*));
-
   chill_real_input_filename = input_filename;
 
   /* the beginning of the file is a new line; check for # */



1999-08-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* decl.c: Remove redundant prototype for `print_error_function'.
	(lang_print_error_function): Constify a char*.

	* lex.c (lang_identify): Likewise.

diff -rup orig/egcs-CVS19990808/gcc/cp/decl.c egcs-CVS19990808/gcc/cp/decl.c
--- orig/egcs-CVS19990808/gcc/cp/decl.c	Sat Aug  7 18:17:01 1999
+++ egcs-CVS19990808/gcc/cp/decl.c	Sun Aug  8 12:29:03 1999
@@ -59,7 +59,6 @@ extern int static_labelno;
 extern tree current_namespace;
 extern tree global_namespace;
 
-extern void (*print_error_function) PROTO((char *));
 extern int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree));
 
 /* Obstack used for remembering local class declarations (like
@@ -168,7 +167,7 @@ static void record_unknown_type PROTO((t
 static int member_function_or_else PROTO((tree, tree, const char *));
 static void bad_specifiers PROTO((tree, const char *, int, int, int, int,
 				  int));
-static void lang_print_error_function PROTO((char *));
+static void lang_print_error_function PROTO((const char *));
 static tree maybe_process_template_type_declaration PROTO((tree, int, struct binding_level*));
 static void check_for_uninitialized_const_var PROTO((tree));
 static unsigned long typename_hash PROTO((hash_table_key));
@@ -6607,7 +6606,7 @@ init_decl_processing ()
 
 static void
 lang_print_error_function (file)
-     char *file;
+     const char *file;
 {
   default_print_error_function (file);
   maybe_print_template_context ();
diff -rup orig/egcs-CVS19990808/gcc/cp/lex.c egcs-CVS19990808/gcc/cp/lex.c
--- orig/egcs-CVS19990808/gcc/cp/lex.c	Sat Aug  7 18:17:03 1999
+++ egcs-CVS19990808/gcc/cp/lex.c	Sun Aug  8 11:41:09 1999
@@ -423,7 +423,7 @@ lang_finish ()
   if (flag_gnu_xref) GNU_xref_end (errorcount+sorrycount);
 }
 
-char *
+const char *
 lang_identify ()
 {
   return "cplusplus";




1999-08-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* com.c (lang_print_error_function): Constify a char*.
	(init_parse): Remove redundant prototype for `print_error_function'.
	(lang_identify): Constify a char*.

diff -rup orig/egcs-CVS19990808/gcc/f/com.c egcs-CVS19990808/gcc/f/com.c
--- orig/egcs-CVS19990808/gcc/f/com.c	Mon Jul 26 07:42:18 1999
+++ egcs-CVS19990808/gcc/f/com.c	Sun Aug  8 11:46:29 1999
@@ -14438,7 +14438,7 @@ lang_printable_name (tree decl, int v)
 #if BUILT_FOR_270
 void
 lang_print_error_function (file)
-     char *file;
+     const char *file;
 {
   static ffeglobal last_g = NULL;
   static ffesymbol last_s = NULL;
@@ -14928,10 +14928,6 @@ char *
 init_parse (filename)
      char *filename;
 {
-#if BUILT_FOR_270
-  extern void (*print_error_function) (char *);
-#endif
-
   /* Open input file.  */
   if (filename == 0 || !strcmp (filename, "-"))
     {
@@ -15023,7 +15019,7 @@ lang_finish ()
     malloc_pool_display (malloc_pool_image ());
 }
 
-char *
+const char *
 lang_identify ()
 {
   return "f77";




1999-08-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* lang.c (java_dummy_print): Constify a char*.
	(lang_print_error): Likewise.
	(lang_init): Remove redundant prototype for `print_error_function'.
	(lang_init_source): Likewise.
	(lang_identify): Constify a char*.
	
diff -rup orig/egcs-CVS19990808/gcc/java/lang.c egcs-CVS19990808/gcc/java/lang.c
--- orig/egcs-CVS19990808/gcc/java/lang.c	Sun Aug  8 12:24:10 1999
+++ egcs-CVS19990808/gcc/java/lang.c	Sun Aug  8 11:47:57 1999
@@ -38,7 +38,7 @@ The Free Software Foundation is independ
 
 static void put_decl_string PROTO ((const char *, int));
 static void put_decl_node PROTO ((tree));
-static void java_dummy_print PROTO ((char *));
+static void java_dummy_print PROTO ((const char *));
 
 #ifndef OBJECT_SUFFIX
 # define OBJECT_SUFFIX ".o"
@@ -455,7 +455,7 @@ lang_printable_name (decl, v)
 
 void
 lang_print_error (file)
-     char *file;
+     const char *file;
 {
   static tree last_error_function_context = NULL_TREE;
   static tree last_error_function = NULL;
@@ -491,7 +491,6 @@ lang_print_error (file)
 void
 lang_init ()
 {
-  extern void (*print_error_function) PROTO((char *));
 #if 0
   extern int flag_minimal_debug;
   flag_minimal_debug = 0;
@@ -529,7 +528,7 @@ lang_init ()
 
 static void
 java_dummy_print (s)
-     char *s __attribute__ ((__unused__));
+     const char *s ATTRIBUTE_UNUSED;
 {
 }
 
@@ -543,7 +542,6 @@ java_dummy_print (s)
 void lang_init_source (level)
      int level;
 {
-  extern void (*print_error_function) PROTO((char *));
   if (level == 1)
     print_error_function = java_dummy_print;
   else 
@@ -561,7 +559,7 @@ lang_finish ()
 {
 }
 
-char*
+const char *
 lang_identify ()
 {
   return "Java";


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