Patch [libf2c]: random warning fixes

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sun Jun 2 09:22:00 GMT 2002


Fixes:

libI77/lread.c:16: warning: `quad_read' defined but not used
libI77/uio.c:39: warning: implicit declaration of function `memset'
libI77/wref.c:85: warning: subscript has type `char'
libF77/main.c:20: warning: implicit declaration of function `f_setarg'
libF77/main.c:21: warning: implicit declaration of function `f_setsig'
libU77/etime_.c:52: warning: `clk_tck' defined but not used
libU77/dtime_.c:52: warning: `clk_tck' defined but not used

Note WRT libF77/main.c, normally I'd prototype functions inside a
header, not .C module.  But for now I followed the existing convention
inside libf2c for these implicit warnings.  Later on I'll move
prototypes into header files in batches.

Tested on solaris2.7, ok to install?

		Thanks,
		--Kaveh


2002-06-02  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* libF77/main.c (f_setarg, f_setsig): Prototype.
	* libI77/lread.c (quad_read): Delete.
	* libI77/uio.c: Include config.h.
	* libI77/wref.c (wrt_E): Cast isdigit arg to unsigned char.
	* libU77/dtime_.c (clk_tck): Move to the scope where it is used.
	* libU77/etime_.c (clk_tck): Likewise.

diff -rup orig/egcc-CVS20020601/libf2c/libF77/main.c egcc-CVS20020601/libf2c/libF77/main.c
--- orig/egcc-CVS20020601/libf2c/libF77/main.c	2002-06-01 23:04:22.000000000 -0400
+++ egcc-CVS20020601/libf2c/libF77/main.c	2002-06-02 11:27:48.470733305 -0400
@@ -13,6 +13,8 @@ extern int atexit (void (*)(void));
 
 extern void f_init (void);
 extern int MAIN__ (void);
+extern void f_setarg (int, char **);
+extern void f_setsig (void);
 
 int
 main (int argc, char **argv)
diff -rup orig/egcc-CVS20020601/libf2c/libI77/lread.c egcc-CVS20020601/libf2c/libI77/lread.c
--- orig/egcc-CVS20020601/libf2c/libI77/lread.c	2002-06-01 23:04:32.000000000 -0400
+++ egcc-CVS20020601/libf2c/libI77/lread.c	2002-06-02 11:22:39.651461130 -0400
@@ -13,7 +13,6 @@ extern int f__fmtlen;
 
 #ifdef Allow_TYQUAD
 static longint f__llx;
-static int quad_read;
 #endif
 
 #undef abs
diff -rup orig/egcc-CVS20020601/libf2c/libI77/uio.c egcc-CVS20020601/libf2c/libI77/uio.c
--- orig/egcc-CVS20020601/libf2c/libI77/uio.c	2002-06-01 23:04:22.000000000 -0400
+++ egcc-CVS20020601/libf2c/libI77/uio.c	2002-06-02 11:23:39.125515651 -0400
@@ -1,3 +1,4 @@
+#include "config.h"
 #include "f2c.h"
 #include "fio.h"
 #include <sys/types.h>
diff -rup orig/egcc-CVS20020601/libf2c/libI77/wref.c egcc-CVS20020601/libf2c/libI77/wref.c
--- orig/egcc-CVS20020601/libf2c/libI77/wref.c	2002-06-01 23:04:32.000000000 -0400
+++ egcc-CVS20020601/libf2c/libI77/wref.c	2002-06-02 11:24:00.203408446 -0400
@@ -82,7 +82,7 @@ wrt_E (ufloat * p, int w, int d, int e, 
   sprintf (buf, "%#.*E", d, dd);
 #ifndef VAX
   /* check for NaN, Infinity */
-  if (!isdigit (buf[0]))
+  if (!isdigit ((unsigned char) buf[0]))
     {
       switch (buf[0])
 	{
diff -rup orig/egcc-CVS20020601/libf2c/libU77/dtime_.c egcc-CVS20020601/libf2c/libU77/dtime_.c
--- orig/egcc-CVS20020601/libf2c/libU77/dtime_.c	2002-06-01 08:31:54.000000000 -0400
+++ egcc-CVS20020601/libf2c/libU77/dtime_.c	2002-06-02 11:32:41.641412378 -0400
@@ -44,13 +44,6 @@ Boston, MA 02111-1307, USA.  */
 #include <errno.h>		/* for ENOSYS */
 #include "f2c.h"
 
-/* For dtime, etime we store the clock tick parameter (clk_tck) the
-   first time either of them is invoked rather than each time.  This
-   approach probably speeds up each invocation by avoiding a system
-   call each time, but means that the overhead of the first call is
-   different to all others. */
-static long clk_tck = 0;
-
 double
 G77_dtime_0 (real tarray[2])
 {
@@ -136,6 +129,12 @@ G77_dtime_0 (real tarray[2])
     (float) (rbuff.ru_stime).tv_usec / 1000000.0;
   tarray[1] = stime - old_stime;
 #else /* HAVE_GETRUSAGE */
+  /* For dtime, etime we store the clock tick parameter (clk_tck) the
+     first time either of them is invoked rather than each time.  This
+     approach probably speeds up each invocation by avoiding a system
+     call each time, but means that the overhead of the first call is
+     different to all others. */
+  static long clk_tck = 0;
   time_t utime, stime;
   static time_t old_utime = 0, old_stime = 0;
   struct tms buffer;
diff -rup orig/egcc-CVS20020601/libf2c/libU77/etime_.c egcc-CVS20020601/libf2c/libU77/etime_.c
--- orig/egcc-CVS20020601/libf2c/libU77/etime_.c	2002-06-01 08:31:54.000000000 -0400
+++ egcc-CVS20020601/libf2c/libU77/etime_.c	2002-06-02 11:32:47.000906370 -0400
@@ -44,13 +44,6 @@ Boston, MA 02111-1307, USA.  */
 #include <errno.h>		/* for ENOSYS */
 #include "f2c.h"
 
-/* For dtime, etime we store the clock tick parameter (clk_tck) the
-   first time either of them is invoked rather than each time.  This
-   approach probably speeds up each invocation by avoiding a system
-   call each time, but means that the overhead of the first call is
-   different to all others. */
-static long clk_tck = 0;
-
 double
 G77_etime_0 (real tarray[2])
 {
@@ -131,6 +124,12 @@ G77_etime_0 (real tarray[2])
   tarray[1] = ((float) (rbuff.ru_stime).tv_sec +
 	       (float) (rbuff.ru_stime).tv_usec / 1000000.0);
 #else /* HAVE_GETRUSAGE */
+  /* For dtime, etime we store the clock tick parameter (clk_tck) the
+     first time either of them is invoked rather than each time.  This
+     approach probably speeds up each invocation by avoiding a system
+     call each time, but means that the overhead of the first call is
+     different to all others. */
+  static long clk_tck = 0;
   struct tms buffer;
 
 /* NeXTStep seems to define _SC_CLK_TCK but not to have sysconf;



More information about the Gcc-patches mailing list