This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove warning cleanups
- To: egcs-patches at egcs dot cygnus dot com
- Subject: [PATCH] Remove warning cleanups
- From: ahaas at neosoft dot com
- Date: Wed, 7 Apr 1999 17:27:43 -0500
Hi.
Here are two more patches which get rid of warnings seen in
the latest snapshot.
The first is for 'cccp.c' - the warnings are comparing signed
and unsigned values. To my (untrained) eye, the check performed
by the code seems silly, so removing the check removes the warnings.
Maybe I'm missing something obvious...
==========================================================
--- egcs-19990405/gcc/cccp.c.orig Mon Apr 5 10:34:04 1999
+++ egcs-19990405/gcc/cccp.c Wed Apr 7 13:26:31 1999
@@ -2234,8 +2234,6 @@
/* Read a file whose size we can determine in advance.
For the sake of VMS, st.st_size is just an upper bound. */
size_t s = (size_t) st.st_size;
- if (s != st.st_size || s + 2 < s)
- memory_full ();
fp->buf = (U_CHAR *) xmalloc (s + 2);
fp->length = safe_read (f, (char *) fp->buf, s);
if (fp->length < 0) goto perror;
@@ -5327,8 +5325,6 @@
if (S_ISREG (inc->st.st_mode)) {
size_t s = (size_t) inc->st.st_size;
- if (s != inc->st.st_size || s + 2 < s)
- memory_full ();
fp->buf = (U_CHAR *) xmalloc (s + 2);
fp->bufp = fp->buf;
@@ -5450,8 +5446,6 @@
if (S_ISREG (st->st_mode))
{
size_t s = (size_t) st->st_size;
- if (s != st->st_size || s + 2 < s)
- memory_full ();
buf = xmalloc (s + 2);
length = safe_read (pcf, buf, s);
if (length < 0)
==============================================================
The second patch is for 'final.c' - on i386, the ASM_OPEN_PAREN
and ASM_CLOSE_PAREN are "", while every other platform I could
find they are "(" and ")". Assuming the macro as it stands
is correct, this fix gets rid of a zero-length format string
warning.
==============================================================
--- egcs-19990405/gcc/final.c.orig Mon Apr 5 10:34:43 1999
+++ egcs-19990405/gcc/final.c Wed Apr 7 15:12:41 1999
@@ -3653,9 +3653,9 @@
if (GET_CODE (XEXP (x, 1)) == CONST_INT
&& INTVAL (XEXP (x, 1)) < 0)
{
- fprintf (file, ASM_OPEN_PAREN);
+ fprintf (file, "%s", ASM_OPEN_PAREN);
output_addr_const (file, XEXP (x, 1));
- fprintf (file, ASM_CLOSE_PAREN);
+ fprintf (file, "%s", ASM_CLOSE_PAREN);
}
else
output_addr_const (file, XEXP (x, 1));
==============================================================
I rebuilt the latest snapshot with these patches - no regressions
on i586-pc-linux-gnu.
Do patches this small require a ChangeLog entry? I'll resubmit
with one if desired.
Enjoy.
Art Haas