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]
Other format: [Raw text]

Patch to fix signed/unsigned warnings in all ASM_OUTPUT_ASCII macros


This patch fixes all ASM_OUTPUT_ASCII macros (that are actually used
by one of my tested targets).  The result is modest, it fixes these
unique warnings where ASM_OUTOUT_ASCII is called from:

 > varasm.c:1358: warning: comparison between signed and unsigned
 > varasm.c:1358: warning: suggest explicit braces to avoid ambiguous `else'
 > varasm.c:1358: warning: pointer targets in assignment differ in signedness
 > dwarf2asm.c:320: warning: comparison between signed and unsigned
 > dwarf2asm.c:320: warning: suggest explicit braces to avoid ambiguous `else'
 > dwarf2asm.c:320: warning: pointer targets in assignment differ in signedness

However there are about 70 warnings if you count repeats from each
target. :-)

The signed/unsigned warnings were fixed by always ensuring a size_t to
size_t comparison by introducing a "limit" variable (as is done in
other working ASM_OUTOUT_ASCII copies) rather than testing the macro
parameter directly.  This also avoids multiple evaluation of the
LEN/SIZE/size (whatever its called) parameter.

Test via cross-compiles of cc1 from sparc-sun-solaris2.7 to:

1750a-unknown-elf arc-unknown-elf avr-unknown-elf
clipper-intergraph-clix d30v-unknown-elf dsp16xx-unknown-elf
elxsi-elxsi-elf fr30-unknown-elf m32r-unknown-elf mmix-knuth-mmixware
mn10200-unknown-elf mn10300-unknown-elf pj-unknown-linux-gnu
pjl-unknown-elf we32k-att-sysv xstormy16-unknown-elf a29k-unknown-sym1
a29k-unknown-coff a29k-unknown-rtems a29k-wrs-vxworks a29k-unknown-elf
c1-convex-elf c2-convex-elf c32-convex-elf c34-convex-elf
c38-convex-elf c4x-unknown-rtems c4x-unknown-elf cris-unknown-aout
cris-unknown-elf cris-unknown-linux-gnu h8300-unknown-rtems
h8300-unknown-elf h8300-unknown-aout i370-unknown-opened
i370-unknown-mvs i370-unknown-linux-gnu i860-alliant-bsd
i860-unknown-bsd i860-unknown-mach i860-unknown-osf i860-unknown-sysv3
i860-unknown-sysv4 i960-wrs-vxworks5.0 i960-wrs-vxworks5.1
i960-wrs-vxworks4 i960-unknown-coff i960-unknown-rtems
i960-unknown-elf ia64-unknown-aix ia64-unknown-elf
ia64-unknown-freebsd6 ia64-unknown-linux-gnu ia64-unknown-hpux
m88k-dg-dgux m88k-dolphin-sysv3 m88k-tektronix-sysv3 m88k-unknown-aout
m88k-unknown-coff m88k-unknown-luna m88k-unknown-openbsd
m88k-unknown-sysv3 m88k-unknown-sysv4 mcore-unknown-elf
mcore-unknown-pe ns32k-encore-bsd ns32k-sequent-bsd ns32k-tek6100-bsd
ns32k-tek6200-bsd ns32k-merlin-bsd ns32k-pc532-mach ns32k-pc532-minix
ns32k-unknown-netbsd pdp11-unknown-bsd pdp11-unknown-elf
romp-unknown-aos romp-unknown-mach s390-unknown-linux-gnu
s390x-unknown-linux-gnu sh-unknown-elf sh-unknown-rtemself
sh-unknown-rtems sh-unknown-linux-gnu sh-unknown-aout
v850-unknown-rtems v850-unknown-elf alpha-unknown-unicosmk
alpha-unknown-interix alpha-unknown-linux-gnuecoff
alpha-unknown-linux-gnulibc1 alpha-unknown-linux-gnu
alpha-unknown-freebsd5 alpha-unknown-netbsd alpha-unknown-openbsd
alpha-dec-osf1 alpha-dec-osf2 alpha-dec-osf4.0a alpha-dec-osf4.0b
alpha-dec-osf4.1 alpha-dec-osf5 alpha-unknown-vxworks alpha-dec-vms
arm-unknown-rtems arm-unknown-coff arm-unknown-vxworks
arm-unknown-riscix1.0 arm-unknown-riscix arm-semi-aout arm-semi-aof
arm-unknown-netbsd arm-unknown-linux-gnu arm-unknown-uclinux
arm-unknown-aout arm-unknown-elf arm-unknown-conix arm-unknown-oabi
arm-unknown-pe strongarm-unknown-elf strongarm-unknown-coff
strongarm-unknown-pe vax-unknown-bsd vax-unknown-sysv
vax-unknown-netbsd vax-unknown-openbsd vax-unknown-ultrix
vax-unknown-vms vax-unknown-elf xscale-unknown-elf xscale-unknown-coff
hppa64-unknown-linux-gnu hppa1.0-unknown-linux-gnu
hppa1.1-unknown-rtems hppa1.1-unknown-proelf hppa1.1-unknown-osf
hppa1.0-unknown-osf hppa1.1-unknown-bsd hppa1.0-unknown-bsd
hppa1.0-hp-hpux7 hppa1.0-hp-hpux8.02 hppa1.1-hp-hpux8.02
hppa1.1-hp-hpux8 hppa1.0-hp-hpux8 hppa1.1-hp-hpux10 hppa1.0-hp-hpux10
hppa64-hp-hpux11 hppa1.1-hp-hpux11 hppa1.0-hp-hpux11 hppa1.1-hp-hpux
hppa1.0-hp-hpux hppa1.1-unknown-hiux hppa1.0-unknown-hiux
hppa1.0-unknown-lites i386-chorusos i386-unknown-elf i386-ibm-aix
i386-ncr-sysv4 i386-next-nextstep i386-unknown-netware
i386-sequent-bsd i386-sequent-ptx1 i386-sequent-ptx2 i386-sequent-ptx4
i386-sun-sunos i386-wrs-vxworks i386-unknown-aout i386-unknown-beoself
i386-unknown-bsdi i386-unknown-bsd i386-unknown-freebsd2
i386-unknown-freebsd4 i386-unknown-netbsdelf i386-unknown-netbsd
i386-unknown-openbsd i386-unknown-coff i386-unknown-isc
i386-unknown-linux-gnuoldld i386-unknown-linux-gnuaout
i386-unknown-linux-gnulibc1 i386-unknown-linux-gnu
x86_64-unknown-linux-gnu i386-unknown-gnu i386-pc-msdosdjgpp
i386-moss-msdos i386-unknown-lynxos i386-unknown-mach
i386-unknown-osfrose i386-go32-rtems i386-unknown-rtemscoff
i386-unknown-rtems i386-unknown-sco3.2v5 i386-sun-solaris2.7
i386-unknown-sysv5 i386-unknown-sysv4 i386-unknown-udk
i386-unknown-osf1 i386-unknown-sysv i386-unknown-vsta i386-unknown-pe
i386-unknown-mingw32 i386-unknown-uwin i386-unknown-interix
i386-dg-dgux m68000-convergent-sysv m68000-hp-bsd m68000-hp-hpux
m68000-sun-sunos3 m68000-sun-sunos4 m68000-att-sysv m68k-apple-aux
m68k-apollo-elf m68k-bull-sysv m68k-atari-sysv4 m68k-motorola-sysv
m68k-ncr-sysv m68k-plexus-sysv m68k-tti-elf m68k-crds-unos
m68k-cbm-sysv4 m68k-ccur-rtu m68k-hp-bsd4.4 m68k-hp-bsd m68k-isi-bsd
m68k-hp-hpux7 m68k-hp-hpux m68k-sun-mach m68k-sony-newsos3
m68k-sony-bsd m68k-next-nextstep2 m68k-next-nextstep3 m68k-sun-sunos3
m68k-sun-sunos4 m68k-wrs-vxworks m68k-unknown-aout m68k-unknown-coff
m68020-unknown-elf m68k-unknown-lynxos m68k-unknown-netbsd
m68k-unknown-openbsd m68k-unknown-sysv3 m68k-unknown-sysv4
m68k-unknown-linux-gnuaout m68k-unknown-linux-gnulibc1
m68k-unknown-linux-gnu m68k-unknown-psos m68k-unknown-rtemscoff
m68k-unknown-rtemself mips-sgi-irix6.5 mips-wrs-vxworks mips-sni-sysv4
mips-sgi-irix5 mips-sgi-irix4loser mips-sgi-irix4 mips-sgi-irix3
mips-dec-osfrose mips-dec-osf mips-dec-bsd mipsel-unknown-netbsd
mips-unknown-linux-gnu mipsel-unknown-openbsd mips-unknown-openbsd
mips-sony-bsd mips-sony-sysv mips-tandem-sysv4 mips-unknown-ultrix
mips-unknown-riscos5bsd mips-unknown-riscosbsd
mips-unknown-riscos5sysv4 mips-unknown-sysv4 mips-unknown-riscos5sysv
mips-unknown-sysv mips-unknown-riscos5 mipsel-unknown-ecoff
mips-unknown-ecoff mipsisa32-unknown-elf mipsel-unknown-elf
mips-unknown-elf mips64el-unknown-elf mips64orionel-unknown-elf
mips64-unknown-elf mips64orion-unknown-elf mips64orion-unknown-rtems
mips-unknown-rtems mipstx39el-unknown-elf mipstx39-unknown-elf
mips-unknown-riscos4 powerpc64-unknown-linux-gnu powerpc-unknown-beos
powerpc-unknown-darwin powerpc-unknown-sysv powerpc-unknown-netbsd
powerpc-chorusos powerpc-unknown-eabiaix powerpc-unknown-eabisim
powerpc-unknown-elf powerpc-unknown-eabi powerpc-unknown-rtems
powerpc-unknown-linux-gnulibc1 powerpc-unknown-linux-gnu
powerpc-wrs-vxworks powerpcle-wrs-vxworks powerpcle-unknown-sysv
powerpcle-unknown-elf powerpcle-unknown-eabisim powerpcle-unknown-eabi
rs6000-ibm-aix3.0 rs6000-ibm-aix3.2.4 rs6000-ibm-aix4.1
rs6000-ibm-aix4.3 rs6000-ibm-aix5.0 rs6000-ibm-aix rs6000-bull-bosx
rs6000-unknown-mach rs6000-unknown-lynxos sparc-tti-bsd
sparc64-wrs-vxworks sparc-wrs-vxworks sparc-unknown-aout
sparc-unknown-netbsd sparc-unknown-openbsd sparc-unknown-bsd
sparc-chorusos sparc-unknown-elf sparc-unknown-linux-gnuaout
sparc-unknown-linux-gnulibc1 sparc-unknown-linux sparc-unknown-lynxos
sparc-unknown-rtemsaout sparc-unknown-rtems sparcv9-sun-solaris2.8
sparc-hal-solaris2.4 sparc-sun-solaris2.0 sparc-sun-solaris2.7
sparc-sun-sunos4.0 sparc-sun-sunos4.1 sparc-sun-sunos3
sparc-unknown-sysv4 sparc-unknown-vxsim sparclet-unknown-aout
sparclite-unknown-coff sparclite-unknown-aout sparclite-unknown-elf
sparc86x-unknown-aout sparc86x-unknown-elf sparc64-unknown-aout
sparc64-unknown-elf sparc64-unknown-linux-gnu


Ok to install?

		Thanks,
		--Kaveh


2001-12-02  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* clipper/clix.h (ASM_OUTPUT_ASCII): Avoid signed/unsigned
	warnings.
	* convex.h (ASM_OUTPUT_ASCII): Likewise.
	* i370.h (ASM_OUTPUT_ASCII): Likewise.
	* i386/att.h (ASM_OUTPUT_ASCII): Likewise.
	* i386/i386-interix.h (ASM_OUTPUT_ASCII): Likewise.
	* i386/i386elf.h (ASM_OUTPUT_ASCII): Likewise.
	* i386/ptx4-i.h (ASM_OUTPUT_ASCII): Likewise.
	* i386/sco5.h (ASM_OUTPUT_ASCII): Likewise.
	* i386/sun386.h (ASM_OUTPUT_ASCII): Likewise.
	* i386/sysv4.h (ASM_OUTPUT_ASCII): Likewise.
	* i860/bsd.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/3b1.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/amix.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/atari.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/crds.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/hp320.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/m68kv4.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/mot3300.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/sgs.h (ASM_OUTPUT_ASCII): Likewise.
	* m68k/tower-as.h (ASM_OUTPUT_ASCII): Likewise.
	* mips/bsd-5.h (ASM_OUTPUT_ASCII): Likewise.
	* mips/mips-5.h (ASM_OUTPUT_ASCII): Likewise.
	* mips/svr3-5.h (ASM_OUTPUT_ASCII): Likewise.
	* mips/svr4-5.h (ASM_OUTPUT_ASCII): Likewise.
	* ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise.
	* vax/vaxv.h (ASM_OUTPUT_ASCII): Likewise.
	* we32k/we32k.h (ASM_OUTPUT_ASCII): Likewise.

diff -rup orig/egcc-CVS20011201/gcc/config/clipper/clix.h egcc-CVS20011201/gcc/config/clipper/clix.h
--- orig/egcc-CVS20011201/gcc/config/clipper/clix.h	Mon Nov 19 07:30:31 2001
+++ egcc-CVS20011201/gcc/config/clipper/clix.h	Sun Dec  2 15:46:40 2001
@@ -35,9 +35,9 @@ Boston, MA 02111-1307, USA.  */
 
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)			\
 do {							\
-  const unsigned char *s;				\
-  int i;						\
-  for (i = 0, s = (const unsigned char *)(PTR); i < (LEN); s++, i++) \
+  const unsigned char *s = (const unsigned char *)(PTR);\
+  size_t i, limit = (LEN);				\
+  for (i = 0; i < limit; s++, i++)			\
     {							\
       if ((i % 8) == 0)					\
 	fputs ("\n\t.byte\t", (FILE));			\
diff -rup orig/egcc-CVS20011201/gcc/config/convex/convex.h egcc-CVS20011201/gcc/config/convex/convex.h
--- orig/egcc-CVS20011201/gcc/config/convex/convex.h	Wed Nov 21 21:12:04 2001
+++ egcc-CVS20011201/gcc/config/convex/convex.h	Sun Dec  2 15:50:51 2001
@@ -1312,9 +1312,9 @@ enum reg_class {
 /* This is how to output a string */
 
 #define ASM_OUTPUT_ASCII(FILE,STR,SIZE) do {				\
-  int i;								\
+  size_t i, limit = (SIZE);						\
   fprintf ((FILE), "\tds.b \"");					\
-  for (i = 0; i < (SIZE); i++) {					\
+  for (i = 0; i < limit; i++) {						\
       register int c = (STR)[i] & 0377;					\
       if (c >= ' ' && c < 0177 && c != '\\' && c != '"')		\
 	  putc (c, (FILE));						\
diff -rup orig/egcc-CVS20011201/gcc/config/i370/i370.h egcc-CVS20011201/gcc/config/i370/i370.h
--- orig/egcc-CVS20011201/gcc/config/i370/i370.h	Wed Nov 21 21:12:04 2001
+++ egcc-CVS20011201/gcc/config/i370/i370.h	Sun Dec  2 16:00:24 2001
@@ -1232,11 +1232,11 @@ enum reg_class
 
 #define ASM_OUTPUT_ASCII(FILE, PTR, LEN)				\
 {									\
-  int i, j;								\
-  int c;								\
-  for (j = 0, i = 0; i < LEN; j++, i++)					\
+  size_t i, limit = (LEN);						\
+  int j;								\
+  for (j = 0, i = 0; i < limit; j++, i++)				\
     {									\
-      c = PTR[i];							\
+      int c = (PTR)[i];							\
       if (ISCNTRL (c) || c == '&')					\
 	{								\
 	  if (j % MVS_ASCII_TEXT_LENGTH != 0 )				\
diff -rup orig/egcc-CVS20011201/gcc/config/i386/att.h egcc-CVS20011201/gcc/config/i386/att.h
--- orig/egcc-CVS20011201/gcc/config/i386/att.h	Sun Nov 11 00:53:29 2001
+++ egcc-CVS20011201/gcc/config/i386/att.h	Sun Dec  2 16:13:40 2001
@@ -36,14 +36,14 @@ Boston, MA 02111-1307, USA.  */
 
 /* How to output an ASCII string constant.  */
 
-#define ASM_OUTPUT_ASCII(FILE, p, size) \
+#define ASM_OUTPUT_ASCII(FILE, PTR, SIZE)			\
 do								\
-{ int i = 0; 							\
-  while (i < (size))						\
+{ size_t i = 0, limit = (SIZE); 				\
+  while (i < limit)						\
     { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n");	\
 		       fprintf ((FILE), "%s", ASM_BYTE_OP); }	\
       else fprintf ((FILE), ",");				\
-	fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;}		\
+	fprintf ((FILE), "0x%x", ((PTR)[i++] & 0377)) ;}	\
       fprintf ((FILE), "\n");					\
 } while (0)
 
diff -rup orig/egcc-CVS20011201/gcc/config/i386/i386-interix.h egcc-CVS20011201/gcc/config/i386/i386-interix.h
--- orig/egcc-CVS20011201/gcc/config/i386/i386-interix.h	Sun Nov 11 00:53:29 2001
+++ egcc-CVS20011201/gcc/config/i386/i386-interix.h	Sun Dec  2 16:23:03 2001
@@ -202,7 +202,7 @@ Boston, MA 02111-1307, USA.  */
 	    }								\
 	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
 	    continue;							\
-	  if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)		\
+	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
 	    {								\
 	      if (bytes_in_chunk > 0)					\
 		{							\
diff -rup orig/egcc-CVS20011201/gcc/config/i386/i386elf.h egcc-CVS20011201/gcc/config/i386/i386elf.h
--- orig/egcc-CVS20011201/gcc/config/i386/i386elf.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/i386/i386elf.h	Sun Dec  2 16:06:27 2001
@@ -131,7 +131,7 @@ do { long value[3];							\
 	    }								\
 	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
 	    continue;							\
-	  if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)		\
+	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
 	    {								\
 	      if (bytes_in_chunk > 0)					\
 		{							\
diff -rup orig/egcc-CVS20011201/gcc/config/i386/ptx4-i.h egcc-CVS20011201/gcc/config/i386/ptx4-i.h
--- orig/egcc-CVS20011201/gcc/config/i386/ptx4-i.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/i386/ptx4-i.h	Sun Dec  2 16:18:14 2001
@@ -123,7 +123,7 @@ do { long value[3];							\
 	    }								\
 	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
 	    continue;							\
-	  if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)		\
+	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
 	    {								\
 	      if (bytes_in_chunk > 0)					\
 		{							\
diff -rup orig/egcc-CVS20011201/gcc/config/i386/sco5.h egcc-CVS20011201/gcc/config/i386/sco5.h
--- orig/egcc-CVS20011201/gcc/config/i386/sco5.h	Thu Nov 15 16:30:35 2001
+++ egcc-CVS20011201/gcc/config/i386/sco5.h	Sun Dec  2 16:26:43 2001
@@ -336,7 +336,7 @@ do {									\
 	    }								\
 	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
 	    continue;							\
-	  if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)		\
+	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
 	    {								\
 	      if (bytes_in_chunk > 0)					\
 		{							\
diff -rup orig/egcc-CVS20011201/gcc/config/i386/sun386.h egcc-CVS20011201/gcc/config/i386/sun386.h
--- orig/egcc-CVS20011201/gcc/config/i386/sun386.h	Mon Nov 19 13:27:26 2001
+++ egcc-CVS20011201/gcc/config/i386/sun386.h	Sun Dec  2 16:20:24 2001
@@ -41,14 +41,14 @@ Boston, MA 02111-1307, USA.  */
 
 /* How to output an ASCII string constant.  */
 
-#define ASM_OUTPUT_ASCII(FILE, p, size) \
+#define ASM_OUTPUT_ASCII(FILE, PTR, SIZE) \
 do								\
-{ int i = 0; 							\
-  while (i < (size))						\
+{ size_t i = 0, limit = (SIZE); 				\
+  while (i < limit)						\
     { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n");	\
 		       fprintf ((FILE), "%s", ASM_BYTE_OP); }	\
       else fprintf ((FILE), ",");				\
-      fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;}		\
+      fprintf ((FILE), "0x%x", ((PTR)[i++] & 0377)) ;}		\
       fprintf ((FILE), "\n");					\
 } while (0)
 
diff -rup orig/egcc-CVS20011201/gcc/config/i386/sysv4.h egcc-CVS20011201/gcc/config/i386/sysv4.h
--- orig/egcc-CVS20011201/gcc/config/i386/sysv4.h	Sun Nov  4 17:33:55 2001
+++ egcc-CVS20011201/gcc/config/i386/sysv4.h	Sun Dec  2 16:10:13 2001
@@ -131,7 +131,7 @@ do { long value[3];							\
 	    }								\
 	  for (p = _ascii_bytes; p < limit && *p != '\0'; p++)		\
 	    continue;							\
-	  if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)		\
+	  if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)	\
 	    {								\
 	      if (bytes_in_chunk > 0)					\
 		{							\
diff -rup orig/egcc-CVS20011201/gcc/config/i860/bsd.h egcc-CVS20011201/gcc/config/i860/bsd.h
--- orig/egcc-CVS20011201/gcc/config/i860/bsd.h	Mon Sep 25 09:03:20 2000
+++ egcc-CVS20011201/gcc/config/i860/bsd.h	Sun Dec  2 18:58:45 2001
@@ -7,10 +7,10 @@
 
 #define ASCII_DATA_ASM_OP "\t.byte\t"
 #define	ASM_OUTPUT_ASCII(f, p, size)	\
-do { register unsigned i;		\
+do { register size_t i, limit = (size);	\
   int inside;				\
   inside = FALSE;			\
-  for (i = 0; i < (size); i++) {	\
+  for (i = 0; i < limit; i++) {	\
     if (i % 64 == 0) {			\
       if (i != 0) {			\
 	if (inside)			\
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/3b1.h egcc-CVS20011201/gcc/config/m68k/3b1.h
--- orig/egcc-CVS20011201/gcc/config/m68k/3b1.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/3b1.h	Sun Dec  2 16:35:28 2001
@@ -183,7 +183,7 @@ do { long l;					\
 /* Yet another null terminated string format.  */
 
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-  do { register int sp = 0, lp = 0; \
+  do { register size_t sp = 0, lp = 0, limit = (LEN); \
     fprintf ((FILE), "\tbyte\t"); \
   loop: \
     if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
@@ -192,7 +192,7 @@ do { long l;					\
     else \
       { lp += 5; \
 	fprintf ((FILE), "0x%x", (PTR)[sp]); } \
-    if (++sp < (LEN)) \
+    if (++sp < limit) \
       {	if (lp > 60) \
 	  { lp = 0; \
 	    fprintf ((FILE), "\n%s", ASCII_DATA_ASM_OP); }	\
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/amix.h egcc-CVS20011201/gcc/config/m68k/amix.h
--- orig/egcc-CVS20011201/gcc/config/m68k/amix.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/amix.h	Sun Dec  2 18:33:40 2001
@@ -100,10 +100,10 @@ do {									\
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)				\
 do {								\
-  register int sp = 0, ch;					\
+  register size_t sp = 0, limit = (LEN);			\
   fprintf ((FILE), "%s", BYTE_ASM_OP);				\
   do {								\
-    ch = (PTR)[sp];						\
+    int ch = (PTR)[sp];						\
     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')		\
       {								\
 	fprintf ((FILE), "'%c", ch);				\
@@ -112,7 +112,7 @@ do {								\
       {								\
 	fprintf ((FILE), "0x%x", ch);				\
       }								\
-    if (++sp < (LEN))						\
+    if (++sp < limit)						\
       {								\
 	if ((sp % 10) == 0)					\
 	  {							\
@@ -123,7 +123,7 @@ do {								\
 	    putc (',', (FILE));					\
 	  }							\
       }								\
-  } while (sp < (LEN));						\
+  } while (sp < limit);						\
   putc ('\n', (FILE));						\
 } while (0)
 
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/atari.h egcc-CVS20011201/gcc/config/m68k/atari.h
--- orig/egcc-CVS20011201/gcc/config/m68k/atari.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/atari.h	Sun Dec  2 17:36:19 2001
@@ -60,10 +60,10 @@ int switch_table_difference_label_flag;
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)				\
 {								\
-  register int sp = 0, ch;					\
+  register size_t sp = 0, limit = (LEN);			\
   fprintf ((FILE), "%s", BYTE_ASM_OP);				\
   do {								\
-    ch = (PTR)[sp];						\
+    int ch = (PTR)[sp];						\
     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')		\
       {								\
 	fprintf ((FILE), "'%c", ch);				\
@@ -72,7 +72,7 @@ int switch_table_difference_label_flag;
       {								\
 	fprintf ((FILE), "0x%x", ch);				\
       }								\
-    if (++sp < (LEN))						\
+    if (++sp < limit)						\
       {								\
 	if ((sp % 10) == 0)					\
 	  {							\
@@ -83,7 +83,7 @@ int switch_table_difference_label_flag;
 	    putc (',', (FILE));					\
 	  }							\
       }								\
-  } while (sp < (LEN));						\
+  } while (sp < limit);						\
   putc ('\n', (FILE));						\
 }
 
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/crds.h egcc-CVS20011201/gcc/config/m68k/crds.h
--- orig/egcc-CVS20011201/gcc/config/m68k/crds.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/crds.h	Sun Dec  2 17:29:21 2001
@@ -196,9 +196,9 @@ do { long l[2];						\
 
 #undef  ASM_OUTPUT_ASCII
 #define  ASM_OUTPUT_ASCII(FILE, P , SIZE)				\
-do {  int i;								\
+do {  size_t i, limit = (SIZE);						\
 	  fprintf ((FILE), "\t.ascii \"");				\
-	  for (i = 0; i < (SIZE); i++)					\
+	  for (i = 0; i < limit; i++)					\
 	    {								\
 	      register int c = (P)[i];					\
 	      if (i != 0 && (i / 200) * 200 == i)			\
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/hp320.h egcc-CVS20011201/gcc/config/m68k/hp320.h
--- orig/egcc-CVS20011201/gcc/config/m68k/hp320.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/hp320.h	Sun Dec  2 17:14:27 2001
@@ -547,11 +547,11 @@ do { long l[3];								\
         output_addr_const (FILE, addr);					\
     }}
 
-#define	ASM_OUTPUT_ASCII(f, p, size)	\
-do { register int i;			\
+#define	ASM_OUTPUT_ASCII(f, p, SIZE)	\
+do { size_t i, limit = (SIZE);		\
   int inside;				\
   inside = FALSE;			\
-  for (i = 0; i < (size); i++) {	\
+  for (i = 0; i < limit; i++) {	\
     if (i % 8 == 0) {			\
       if (i != 0) {			\
 	if (inside)			\
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/m68kv4.h egcc-CVS20011201/gcc/config/m68k/m68kv4.h
--- orig/egcc-CVS20011201/gcc/config/m68k/m68kv4.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/m68kv4.h	Sun Dec  2 17:42:44 2001
@@ -215,10 +215,10 @@ do {									\
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)				\
 do {								\
-  register int sp = 0, ch;					\
+  register size_t sp = 0, limit = (LEN);			\
   fprintf ((FILE), "%s", BYTE_ASM_OP);				\
   do {								\
-    ch = (PTR)[sp];						\
+    int ch = (PTR)[sp];						\
     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')		\
       {								\
 	fprintf ((FILE), "'%c", ch);				\
@@ -227,7 +227,7 @@ do {								\
       {								\
 	fprintf ((FILE), "0x%x", ch);				\
       }								\
-    if (++sp < (LEN))						\
+    if (++sp < limit)						\
       {								\
 	if ((sp % 10) == 0)					\
 	  {							\
@@ -238,7 +238,7 @@ do {								\
 	    putc (',', (FILE));					\
 	  }							\
       }								\
-  } while (sp < (LEN));						\
+  } while (sp < limit);						\
   putc ('\n', (FILE));						\
 } while (0)
 
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/mot3300.h egcc-CVS20011201/gcc/config/m68k/mot3300.h
--- orig/egcc-CVS20011201/gcc/config/m68k/mot3300.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/mot3300.h	Sun Dec  2 17:32:23 2001
@@ -418,7 +418,7 @@ do { long l;					\
 
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-  do { register int sp = 0, lp = 0;				\
+  do { register size_t sp = 0, lp = 0, limit = (LEN);		\
     fprintf ((FILE), "%s", ASM_BYTE_OP);			\
   loop:								\
     if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\')	\
@@ -427,7 +427,7 @@ do { long l;					\
     else							\
       { lp += 5;						\
 	fprintf ((FILE), "0x%x", (PTR)[sp]); }			\
-    if (++sp < (LEN))						\
+    if (++sp < limit)						\
       {	if (lp > 60)						\
 	  { lp = 0;						\
 	    fprintf ((FILE), "\n%s", ASCII_DATA_ASM_OP); }	\
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/sgs.h egcc-CVS20011201/gcc/config/m68k/sgs.h
--- orig/egcc-CVS20011201/gcc/config/m68k/sgs.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/sgs.h	Sun Dec  2 17:23:09 2001
@@ -157,10 +157,10 @@ do { long l;						\
 
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)				\
 do {								\
-  register int sp = 0, ch;					\
+  register size_t sp = 0, limit = (LEN);			\
   fprintf ((FILE), "%s", BYTE_ASM_OP);				\
   do {								\
-    ch = (PTR)[sp];						\
+    int ch = (PTR)[sp];						\
     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')		\
       {								\
 	fprintf ((FILE), "'%c", ch);				\
@@ -169,7 +169,7 @@ do {								\
       {								\
 	fprintf ((FILE), "0x%x", ch);				\
       }								\
-    if (++sp < (LEN))						\
+    if (++sp < limit)						\
       {								\
 	if ((sp % 10) == 0)					\
 	  {							\
@@ -180,7 +180,7 @@ do {								\
 	    putc (',', (FILE));					\
 	  }							\
       }								\
-  } while (sp < (LEN));						\
+  } while (sp < limit);						\
   putc ('\n', (FILE));						\
 } while (0)
 
diff -rup orig/egcc-CVS20011201/gcc/config/m68k/tower-as.h egcc-CVS20011201/gcc/config/m68k/tower-as.h
--- orig/egcc-CVS20011201/gcc/config/m68k/tower-as.h	Sun Nov 11 00:53:30 2001
+++ egcc-CVS20011201/gcc/config/m68k/tower-as.h	Sun Dec  2 17:33:53 2001
@@ -90,7 +90,7 @@ Boston, MA 02111-1307, USA.  */
   fprintf (FILE, "\tident\t\"%s\" \n", NAME)
 
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-  do { register int sp = 0, lp = 0; \
+  do { register size_t sp = 0, lp = 0, limit = (LEN); \
     fprintf ((FILE), "\tbyte\t"); \
   loop: \
     if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
@@ -99,7 +99,7 @@ Boston, MA 02111-1307, USA.  */
     else \
       { lp += 5; \
 	fprintf ((FILE), "0x%x", (PTR)[sp]); } \
-    if (++sp < (LEN)) \
+    if (++sp < limit) \
       {	if (lp > 60) \
 	  { lp = 0; \
 	    fprintf ((FILE), "\n\tbyte\t"); }	\
diff -rup orig/egcc-CVS20011201/gcc/config/mips/bsd-5.h egcc-CVS20011201/gcc/config/mips/bsd-5.h
--- orig/egcc-CVS20011201/gcc/config/mips/bsd-5.h	Thu Nov  2 18:29:11 2000
+++ egcc-CVS20011201/gcc/config/mips/bsd-5.h	Sun Dec  2 17:48:04 2001
@@ -56,8 +56,8 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)			\
 do {							\
   const unsigned char *s;				\
-  int i;						\
-  for (i = 0, s = (const unsigned char *)(PTR); i < (LEN); s++, i++) \
+  size_t i, limit = (LEN);				\
+  for (i = 0, s = (const unsigned char *)(PTR); i < limit; s++, i++) \
     {							\
       if ((i % 8) == 0)					\
 	fputs ("\n\t.byte\t", (FILE));			\
diff -rup orig/egcc-CVS20011201/gcc/config/mips/mips-5.h egcc-CVS20011201/gcc/config/mips/mips-5.h
--- orig/egcc-CVS20011201/gcc/config/mips/mips-5.h	Sun Oct 24 15:48:51 1999
+++ egcc-CVS20011201/gcc/config/mips/mips-5.h	Sun Dec  2 17:46:39 2001
@@ -35,8 +35,8 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)			\
 do {							\
   const unsigned char *s;				\
-  int i;						\
-  for (i = 0, s = (const unsigned char *)(PTR); i < (LEN); s++, i++) \
+  size_t i, limit = (LEN);				\
+  for (i = 0, s = (const unsigned char *)(PTR); i < limit; s++, i++) \
     {							\
       if ((i % 8) == 0)					\
 	fputs ("\n\t.byte\t", (FILE));			\
diff -rup orig/egcc-CVS20011201/gcc/config/mips/svr3-5.h egcc-CVS20011201/gcc/config/mips/svr3-5.h
--- orig/egcc-CVS20011201/gcc/config/mips/svr3-5.h	Thu Nov  2 18:29:12 2000
+++ egcc-CVS20011201/gcc/config/mips/svr3-5.h	Sun Dec  2 17:49:18 2001
@@ -78,8 +78,8 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)			\
 do {							\
   const unsigned char *s;				\
-  int i;						\
-  for (i = 0, s = (const unsigned char *)(PTR); i < (LEN); s++, i++) \
+  size_t i, limit = (LEN);						\
+  for (i = 0, s = (const unsigned char *)(PTR); i < limit; s++, i++) \
     {							\
       if ((i % 8) == 0)					\
 	fputs ("\n\t.byte\t", (FILE));			\
diff -rup orig/egcc-CVS20011201/gcc/config/mips/svr4-5.h egcc-CVS20011201/gcc/config/mips/svr4-5.h
--- orig/egcc-CVS20011201/gcc/config/mips/svr4-5.h	Thu Nov  2 18:29:12 2000
+++ egcc-CVS20011201/gcc/config/mips/svr4-5.h	Sun Dec  2 17:45:11 2001
@@ -77,8 +77,8 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)			\
 do {							\
   const unsigned char *s;				\
-  int i;						\
-  for (i = 0, s = (const unsigned char *)(PTR); i < (LEN); s++, i++) \
+  size_t i, limit = (LEN);				\
+  for (i = 0, s = (const unsigned char *)(PTR); i < limit; s++, i++) \
     {							\
       if ((i % 8) == 0)					\
 	fputs ("\n\t.byte\t", (FILE));			\
diff -rup orig/egcc-CVS20011201/gcc/config/ns32k/encore.h egcc-CVS20011201/gcc/config/ns32k/encore.h
--- orig/egcc-CVS20011201/gcc/config/ns32k/encore.h	Sun Nov 11 00:53:31 2001
+++ egcc-CVS20011201/gcc/config/ns32k/encore.h	Sun Dec  2 15:44:48 2001
@@ -128,15 +128,17 @@ do {									\
 
 #define ASM_OUTPUT_ASCII(file, p, size)			\
 do {							\
-  int i;						\
-  for (i = 0; i < (size); i++)				\
+  size_t i, limit = (size);				\
+  for (i = 0; i < limit; i++)				\
     {							\
       register int c = (p)[i];				\
       if ((i / 40) * 40 == i)				\
-      if (i == 0)					\
-        fprintf ((file), "\t.ascii \"");		\
-      else						\
-        fprintf ((file), "\"\n\t.ascii \"");		\
+        {						\
+          if (i == 0)					\
+            fprintf ((file), "\t.ascii \"");		\
+          else						\
+            fprintf ((file), "\"\n\t.ascii \"");	\
+        }						\
       if (c == '\"' || c == '\\')			\
         putc ('\\', (file));				\
       if (c >= ' ' && c < 0177)				\
@@ -144,7 +146,7 @@ do {							\
       else						\
         {						\
           fprintf ((file), "\\%o", c);			\
-          if (i < (size) - 1 && ISDIGIT ((p)[i + 1]))	\
+          if (i < limit - 1 && ISDIGIT ((p)[i + 1]))	\
           fprintf ((file), "\"\n\t.ascii \"");		\
         }						\
     }							\
diff -rup orig/egcc-CVS20011201/gcc/config/vax/vaxv.h egcc-CVS20011201/gcc/config/vax/vaxv.h
--- orig/egcc-CVS20011201/gcc/config/vax/vaxv.h	Fri Aug  3 07:30:23 2001
+++ egcc-CVS20011201/gcc/config/vax/vaxv.h	Sun Dec  2 18:37:21 2001
@@ -51,9 +51,9 @@ output_file_directive ((FILE), main_inpu
 
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)			\
 do {							\
-  const unsigned char *s;				\
-  int i;						\
-  for (i = 0, s = (PTR); i < (LEN); s++, i++)		\
+  const unsigned char *s = (const unsigned char *)(PTR);\
+  size_t i, limit = (LEN);				\
+  for (i = 0; i < limit; s++, i++)		\
     {							\
       if ((i % 8) == 0)					\
 	fputs ("\n\t.byte\t", (FILE));			\
diff -rup orig/egcc-CVS20011201/gcc/config/we32k/we32k.h egcc-CVS20011201/gcc/config/we32k/we32k.h
--- orig/egcc-CVS20011201/gcc/config/we32k/we32k.h	Wed Nov 21 21:12:05 2001
+++ egcc-CVS20011201/gcc/config/we32k/we32k.h	Sun Dec  2 17:52:17 2001
@@ -817,8 +817,8 @@ do { union { float f; long l;} tem;				\
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)  \
 do {							\
   const unsigned char *s;				\
-  int i;						\
-  for (i = 0, s = (const unsigned char *)(PTR); i < (LEN); s++, i++)	\
+  size_t i, limit = (LEN);				\
+  for (i = 0, s = (const unsigned char *)(PTR); i < limit; s++, i++)	\
     {							\
       if ((i % 8) == 0)					\
 	fprintf ((FILE),"%s\t.byte\t",(i?"\n":""));	\


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