From: pfieland@citron.sw.stratus.com (Peggy Fieland)
Subject: (none)
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 20 Jul 1992 20:17:54 GMT

While building gdb-4.6 for our stratus i860, our (ansi-compliant)
c compiler raised the following errors:

cc -c -g      -I. -I. -I./../include -I./../readline  printcmd.c
printcmd.c", line 1929: argument is incompatible with prototype: arg #2 
  cc -c -g      -I. -I. -I./../include -I./../readline  command.c
"command.c", line 715: warning: semantics of "<" change in ANSI C; use explicit cast
	 cc -c -g      -I. -I. -I./../include -I./../readline  -DDEMANGLING_STYLE="gnu" \
	   `echo ./cplus-dem.c | sed 's,^\./,,'`
 "cplus-dem.c", line 839: warning: semantics of ">=" change in ANSI C; use explicit cast
 "cplus-dem.c", line 1241: warning: semantics of "<" change in ANSI C; use explicit cast
 "cplus-dem.c", line 1466: warning: semantics of "<" change in ANSI C; use explicit cast
	 cc -c -g      -I. -I. -I./../include -I./../readline  ieee-float.c
 "ieee-float.c", line 99: warning: semantics of ">>" change in ANSI C; use explicit cast
	 cc -c -g      -I. -I. -I./../include -I./../readline  -I./../bfd ./mipsread.c
 "./mipsread.c", line 2047: warning: semantics of ">=" change in ANSI C; use explicit cast


 Here are fixes: (Note that I was forced to add a function to take care of varargs
 differences).
 

diff -c /home/tools/gnu/gdb-4.6/gdb/printcmd.c printcmd.c
*** /home/tools/gnu/gdb-4.6/gdb/printcmd.c	Mon Jul  6 13:11:00 1992
--- printcmd.c	Fri Jul 17 16:58:26 1992
***************
*** 30,35 ****
--- 30,36 ----
  #include "target.h"
  #include "breakpoint.h"
  #include "demangle.h"
+ #include "stdarg.h"
  
  extern int asm_demangle;	/* Whether to demangle syms in asm printouts */
  extern int addressprint;	/* Whether to print hex addresses in HLL " */
***************
*** 1926,1934 ****
--- 1927,1955 ----
      vprintf (string, list);
    }
  #else /* No __INT_VARARGS_H.  */
+ #if defined(_VA_LIST)
+   {
+      void vjhprintf( char *format, ... );
+ 
+      vjhprintf(string,arg_bytes);
+   }
+ #else /* No __INT_VARARGS_H.  */
    vprintf (string, arg_bytes);
+ #endif /* _VA_LIST */
  #endif /* No __INT_VARARGS_H.  */
  }
+ 
+ void
+ vjhprintf( char *format, ... )
+ {
+ 	va_list	arglist;
+ 
+ 	va_start( arglist, format );
+ 	vprintf ( format, arglist );
+ 	va_end  ( arglist 	  );
+ }
+ 
+ 
  
  /* Helper function for asdump_command.  Finds the bounds of a function
     for a specified section of text.  PC is an address within the

diff -c /home/tools/gnu/gdb-4.6/gdb/command.c command.c
*** /home/tools/gnu/gdb-4.6/gdb/command.c	Tue Jul 14 03:34:20 1992
--- command.c	Thu Jul 16 15:22:02 1992
***************
*** 712,718 ****
  	  for (c = local_list; c; c = c->next)
  	    if (!strncmp (*line, c->name, amb_len))
  	      {
! 		if (strlen (ambbuf) + strlen (c->name) + 6 < (int)sizeof ambbuf)
  		  {
  		    if (strlen (ambbuf))
  		      strcat (ambbuf, ", ");
--- 712,718 ----
  	  for (c = local_list; c; c = c->next)
  	    if (!strncmp (*line, c->name, amb_len))
  	      {
! 		if (strlen (ambbuf) + strlen (c->name) + 6 < (unsigned int)sizeof ambbuf)
  		  {
  		    if (strlen (ambbuf))
  		      strcat (ambbuf, ", ");

diff -c /home/tools/gnu/gdb-4.6/gdb/cplus-dem.c cplus-dem.c
*** /home/tools/gnu/gdb-4.6/gdb/cplus-dem.c	Tue Jul 14 03:34:20 1992
--- cplus-dem.c	Fri Jul 17 09:38:00 1992
***************
*** 836,842 ****
    int success = 0;
  
    n = consume_count (mangled);
!   if (strlen (*mangled) >= n)
      {
        if (work -> constructor || work -> destructor)
  	{
--- 836,842 ----
    int success = 0;
  
    n = consume_count (mangled);
!   if ((int) strlen (*mangled) >= n)
      {
        if (work -> constructor || work -> destructor)
  	{
***************
*** 1238,1244 ****
  		break;
  	      }
  	    n = consume_count (type);
! 	    if (strlen (*type) < n)
  	      {
  		success = 0;
  		break;
--- 1238,1244 ----
  		break;
  	      }
  	    n = consume_count (type);
! 	    if ((int) strlen (*type) < n)
  	      {
  		success = 0;
  		break;
***************
*** 1463,1469 ****
        case '8':
        case '9':
  	n = consume_count (type);
! 	if (strlen (*type) < n)
  	  {
  	    success = 0;
  	    break;
--- 1463,1469 ----
        case '8':
        case '9':
  	n = consume_count (type);
! 	if ((int) strlen (*type) < n)
  	  {
  	    success = 0;
  	    break;

diff -c /home/tools/gnu/gdb-4.6/gdb/ieee-float.c ieee-float.c
*** /home/tools/gnu/gdb-4.6/gdb/ieee-float.c	Mon Jul  6 13:10:52 1992
--- ieee-float.c	Fri Jul 17 09:33:18 1992
***************
*** 96,102 ****
    memcpy (twolongs, from, 8);
    memcpy (tobytes, from, 8);
  #if HOST_BYTE_ORDER == BIG_ENDIAN
!   exponent = ((tobytes[1] & 0xF0) >> 4) | (tobytes[0] & 0x7F) << 4;
    mant0 = (twolongs[0] << 11) | twolongs[1] >> 21;
    mant1 = (twolongs[1] << 11);
  #else
--- 96,102 ----
    memcpy (twolongs, from, 8);
    memcpy (tobytes, from, 8);
  #if HOST_BYTE_ORDER == BIG_ENDIAN
!   exponent = ((unsigned)(tobytes[1] & 0xF0) >> 4) | (tobytes[0] & 0x7F) << 4;
    mant0 = (twolongs[0] << 11) | twolongs[1] >> 21;
    mant1 = (twolongs[1] << 11);
  #else

diff -c /home/tools/gnu/gdb-4.6/gdb/mipsread.c mipsread.c
*** /home/tools/gnu/gdb-4.6/gdb/mipsread.c	Mon Jul  6 13:10:58 1992
--- mipsread.c	Fri Jul 17 09:57:24 1992
***************
*** 2044,2050 ****
  					VAR_NAMESPACE, LOC_BLOCK,
  					objfile->static_psymbols, sh->value);
  		    /* Skip over procedure to next one. */
! 		    if (sh->index >= hdr->iauxMax)
  		      {
  			/* Should not happen, but does when cross-compiling
  			   with the MIPS compiler.  FIXME -- pull later.  */
--- 2044,2050 ----
  					VAR_NAMESPACE, LOC_BLOCK,
  					objfile->static_psymbols, sh->value);
  		    /* Skip over procedure to next one. */
! 		    if ((int) sh->index >= hdr->iauxMax)
  		      {
  			/* Should not happen, but does when cross-compiling
  			   with the MIPS compiler.  FIXME -- pull later.  */

Newsgroups: gnu.gdb.bug