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]

Patch installed: fix for K&R failure & warnings nits


I installed this patch which fixes a minor K&R bootstrap failure on
sunos4 and also zaps a few warnings.

		--Kaveh


2000-03-06  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtins.c (built_in_class_names, built_in_names): Constify a
	char*.

	* gmon-sol2.c (monstartup, moncontrol): Cast ptrs to long, not
	int.
	(_mcleanup): Ensure value matches format specifier in sprintf.

	* cpphash.c (special_symbol): Don't needlessly cast away
	const-ness.

	* cppinit.c (base_name): Delete unused prototype.

	* mkdeps.c (deps_init): Make definition K&R safe.

	* tree.h (built_in_class_names, built_in_names): Constify a
	char*.

f:		
	* ansify.c (die_unless): Don't use ANSI string concatenation.
	(die): Mark with ATTRIBUTE_NORETURN.

diff -rup orig/egcs-CVS20000305/gcc/builtins.c egcs-CVS20000305/gcc/builtins.c
--- orig/egcs-CVS20000305/gcc/builtins.c	Mon Feb 28 22:39:16 2000
+++ egcs-CVS20000305/gcc/builtins.c	Mon Mar  6 11:12:35 2000
@@ -57,10 +57,10 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 /* Define the names of the builtin function types and codes.  */
-char *built_in_class_names[4]
+const char *const built_in_class_names[4]
   = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
 
-char *built_in_names[(int) END_BUILTINS] =
+const char *const built_in_names[(int) END_BUILTINS] =
 {"BUILT_IN_ALLOCA", "BUILT_IN_ABS", "BUILT_IN_FABS", "BUILT_IN_LABS",
   "BUILT_IN_FFS", "BUILT_IN_DIV", "BUILT_IN_LDIV", "BUILT_IN_FFLOOR",
   "BUILT_IN_FCEIL", "BUILT_IN_FMOD", "BUILT_IN_FREM", "BUILT_IN_MEMCPY",
diff -rup orig/egcs-CVS20000305/gcc/config/sparc/gmon-sol2.c egcs-CVS20000305/gcc/config/sparc/gmon-sol2.c
--- orig/egcs-CVS20000305/gcc/config/sparc/gmon-sol2.c	Tue Jan 18 18:31:45 2000
+++ egcs-CVS20000305/gcc/config/sparc/gmon-sol2.c	Mon Mar  6 11:28:58 2000
@@ -102,10 +102,10 @@ void monstartup(lowpc, highpc)
 	 *	so the rest of the scaling (here and in gprof) stays in ints.
 	 */
     lowpc = (char *)
-	    ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
+	    ROUNDDOWN((unsigned long)lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
     s_lowpc = lowpc;
     highpc = (char *)
-	    ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER));
+	    ROUNDUP((unsigned long)highpc, HISTFRACTION*sizeof(HISTCOUNTER));
     s_highpc = highpc;
     s_textsize = highpc - lowpc;
     monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr);
@@ -195,7 +195,7 @@ _mcleanup()
 	else
 	    progname++;
 
-	sprintf(buf, "%s/%ld.%s", profdir, getpid(), progname);
+	sprintf(buf, "%s/%ld.%s", profdir, (long) getpid(), progname);
 	proffile = buf;
     } else {
 	proffile = "gmon.out";
@@ -412,7 +412,7 @@ static void moncontrol(mode)
 	/* start */
 	profil((unsigned short *)(sbuf + sizeof(struct phdr)),
 	       ssiz - sizeof(struct phdr),
-	       (int)s_lowpc, s_scale);
+	       (long)s_lowpc, s_scale);
 	profiling = 0;
     } else {
 	/* stop */
diff -rup orig/egcs-CVS20000305/gcc/cpphash.c egcs-CVS20000305/gcc/cpphash.c
--- orig/egcs-CVS20000305/gcc/cpphash.c	Sat Mar  4 09:07:57 2000
+++ egcs-CVS20000305/gcc/cpphash.c	Mon Mar  6 11:09:26 2000
@@ -897,7 +897,7 @@ special_symbol (hp, pfile)
       while (!ip->nominal_fname && ip != CPP_NULL_BUFFER (pfile))
 	ip = CPP_PREV_BUFFER (ip);
       if (ip->system_header_p
-	  && !cpp_lookup (pfile, (U_CHAR *) "__STRICT_ANSI__", 15))
+	  && !cpp_lookup (pfile, (const U_CHAR *) "__STRICT_ANSI__", 15))
 	CPP_PUTC_Q (pfile, '0');
       else
 #endif
diff -rup orig/egcs-CVS20000305/gcc/cppinit.c egcs-CVS20000305/gcc/cppinit.c
--- orig/egcs-CVS20000305/gcc/cppinit.c	Sat Mar  4 22:56:07 2000
+++ egcs-CVS20000305/gcc/cppinit.c	Mon Mar  6 11:17:12 2000
@@ -178,7 +178,6 @@ static void initialize_builtins		PARAMS 
 static void append_include_chain	PARAMS ((cpp_reader *,
 						 struct cpp_pending *,
 						 char *, int, int));
-static char *base_name			PARAMS ((const char *));
 static void dump_special_to_buffer	PARAMS ((cpp_reader *, const char *));
 static void initialize_dependency_output PARAMS ((cpp_reader *));
 static void initialize_standard_includes PARAMS ((cpp_reader *));
diff -rup orig/egcs-CVS20000305/gcc/f/ansify.c egcs-CVS20000305/gcc/f/ansify.c
--- orig/egcs-CVS20000305/gcc/f/ansify.c	Wed Apr  7 02:48:34 1999
+++ egcs-CVS20000305/gcc/f/ansify.c	Mon Mar  6 11:34:58 2000
@@ -45,12 +45,12 @@ typedef enum
 #define die_unless(c) \
   do if (!(c)) \
     { \
-      fprintf (stderr, "%s:%lu: " #c "\n", argv[1], lineno); \
+      fprintf (stderr, "%s:%lu: %s\n", argv[1], lineno, #c); \
       die (); \
     } \
   while(0)
 
-static void
+static void ATTRIBUTE_NORETURN
 die (void)
 {
   exit (1);
diff -rup orig/egcs-CVS20000305/gcc/mkdeps.c egcs-CVS20000305/gcc/mkdeps.c
--- orig/egcs-CVS20000305/gcc/mkdeps.c	Sun Mar  5 20:36:19 2000
+++ egcs-CVS20000305/gcc/mkdeps.c	Mon Mar  6 11:22:28 2000
@@ -127,7 +127,7 @@ base_name (fname)
 /* Public routines.  */
 
 struct deps *
-deps_init (void)
+deps_init ()
 {
   struct deps *d = (struct deps *) xmalloc (sizeof (struct deps));
 
diff -rup orig/egcs-CVS20000305/gcc/tree.h egcs-CVS20000305/gcc/tree.h
--- orig/egcs-CVS20000305/gcc/tree.h	Sun Mar  5 20:36:21 2000
+++ egcs-CVS20000305/gcc/tree.h	Mon Mar  6 11:12:25 2000
@@ -78,7 +78,7 @@ enum built_in_class
 };
 
 /* Names for the above.  */
-extern char *built_in_class_names[4];
+extern const char *const built_in_class_names[4];
 
 /* Codes that identify the various built in functions
    so that expand_call can identify them quickly.  */
@@ -155,7 +155,7 @@ enum built_in_function
 };
 
 /* Names for the above.  */
-extern char *built_in_names[(int) END_BUILTINS];
+extern const char *const built_in_names[(int) END_BUILTINS];
 
 /* The definition of tree nodes fills the next several pages.  */
 

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