This is the mail archive of the gcc-bugs@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]

mixing pointers to signed and unsigned types


In preparation for some more BeOS work on gcc, I checked out a current
copy of EGCS earlier today, applied my current BeOS patches, and with
some additional tweaking got a clean build of the C compiler (note I
said "build", NOT bootstrap :-).

In the process, the Metrowerks compiler complained about a number of
places where pointers to signed types were being passed to functions
expecting pointers to unsigned types, and vice versa.  I used the
brute force method of casting each passed value rather than analyzing
whether the types of the variables should be changed, so the patch
included below should NOT be taken as a recommendation for how to fix
this (or even whether it needs fixing).  The patch merely serves to
identify the troublesome conversions.

-Fred

Index: gcc/cpphash.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cpphash.c,v
retrieving revision 1.6
diff -c -r1.6 cpphash.c
*** cpphash.c	1998/05/19 08:42:09	1.6
--- cpphash.c	1998/05/25 07:58:20
***************
*** 77,83 ****
  
    bucket = hashtab[hash];
    while (bucket) {
!     if (bucket->length == len && strncmp (bucket->name, name, len) == 0)
        return bucket;
      bucket = bucket->next;
    }
--- 77,83 ----
  
    bucket = hashtab[hash];
    while (bucket) {
!     if (bucket->length == len && strncmp ((const char *) bucket->name, (const char *) name, len) == 0)
        return bucket;
      bucket = bucket->next;
    }
Index: gcc/cpplib.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cpplib.c,v
retrieving revision 1.19
diff -c -r1.19 cpplib.c
*** cpplib.c	1998/05/19 08:42:12	1.19
--- cpplib.c	1998/05/25 07:58:29
***************
*** 536,542 ****
    if (*p == 0)
      {
        buf = (U_CHAR *) alloca (p - buf + 4);
!       strcpy ((char *)buf, str);
        strcat ((char *)buf, " 1");
      }
    else if (*p != '=')
--- 536,542 ----
    if (*p == 0)
      {
        buf = (U_CHAR *) alloca (p - buf + 4);
!       strcpy ((char *)buf, (const char *) str);
        strcat ((char *)buf, " 1");
      }
    else if (*p != '=')
***************
*** 548,555 ****
      {
        U_CHAR *q;
        /* Copy the entire option so we can modify it.  */
!       buf = (U_CHAR *) alloca (2 * strlen (str) + 1);
!       strncpy (buf, str, p - str);
        /* Change the = to a space.  */
        buf[p - str] = ' ';
        /* Scan for any backslash-newline and remove it.  */
--- 548,555 ----
      {
        U_CHAR *q;
        /* Copy the entire option so we can modify it.  */
!       buf = (U_CHAR *) alloca (2 * strlen ((const char *) str) + 1);
!       strncpy ((char *) buf, (const char *) str, p - str);
        /* Change the = to a space.  */
        buf[p - str] = ' ';
        /* Scan for any backslash-newline and remove it.  */
***************
*** 565,571 ****
      *q = 0;
    }
    
!   do_define (pfile, NULL, buf, buf + strlen (buf));
  }
  
  /* Process the string STR as if it appeared as the body of a #assert.
--- 565,571 ----
      *q = 0;
    }
    
!   do_define (pfile, NULL, buf, buf + strlen ((const char *) buf));
  }
  
  /* Process the string STR as if it appeared as the body of a #assert.
***************
*** 580,587 ****
    U_CHAR *buf, *p, *q;
  
    /* Copy the entire option so we can modify it.  */
!   buf = (U_CHAR *) alloca (strlen (str) + 1);
!   strcpy ((char *) buf, str);
    /* Scan for any backslash-newline and remove it.  */
    p = q = buf;
    while (*p) {
--- 580,587 ----
    U_CHAR *buf, *p, *q;
  
    /* Copy the entire option so we can modify it.  */
!   buf = (U_CHAR *) alloca (strlen ((const char *) str) + 1);
!   strcpy ((char *) buf, (const char *) str);
    /* Scan for any backslash-newline and remove it.  */
    p = q = buf;
    while (*p) {
***************
*** 607,613 ****
      return;
    }
    
!   if (cpp_push_buffer (pfile, buf, strlen (buf)) != NULL)
      {
        do_assert (pfile, NULL, NULL, NULL);
        cpp_pop_buffer (pfile);
--- 607,613 ----
      return;
    }
    
!   if (cpp_push_buffer (pfile, buf, strlen ((const char *) buf)) != NULL)
      {
        do_assert (pfile, NULL, NULL, NULL);
        cpp_pop_buffer (pfile);
***************
*** 1048,1054 ****
    for (kt = directive_table; ; kt++) {
      if (kt->length <= 0)
        goto not_a_directive;
!     if (kt->length == ident_length && !strncmp (kt->name, ident, ident_length)) 
        break;
    }
  
--- 1048,1054 ----
    for (kt = directive_table; ; kt++) {
      if (kt->length <= 0)
        goto not_a_directive;
!     if (kt->length == ident_length && !strncmp (kt->name, (const char *) ident, ident_length)) 
        break;
    }
  
***************
*** 1348,1354 ****
  
  	  if (arg->name[0] == c
  	      && arg->length == id_len
! 	      && strncmp (arg->name, id_beg, id_len) == 0) {
  	    if (expected_delimiter && CPP_OPTIONS (pfile)->warn_stringify) {
  	      if (CPP_TRADITIONAL (pfile)) {
  		cpp_warning (pfile, "macro argument `%.*s' is stringified.",
--- 1348,1354 ----
  
  	  if (arg->name[0] == c
  	      && arg->length == id_len
! 	      && strncmp ((const char *) arg->name, (const char *) id_beg, id_len) == 0) {
  	    if (expected_delimiter && CPP_OPTIONS (pfile)->warn_stringify) {
  	      if (CPP_TRADITIONAL (pfile)) {
  		cpp_warning (pfile, "macro argument `%.*s' is stringified.",
***************
*** 1512,1518 ****
  	bp++;
  	/* do we have a "special" rest-args extension here? */
  	if (limit - bp > REST_EXTENSION_LENGTH
! 	    && strncmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) {
  	  rest_args = 1;
  	  temp->rest_args = 1;
  	  break;
--- 1512,1518 ----
  	bp++;
  	/* do we have a "special" rest-args extension here? */
  	if (limit - bp > REST_EXTENSION_LENGTH
! 	    && strncmp (rest_extension, (const char *) bp, REST_EXTENSION_LENGTH) == 0) {
  	  rest_args = 1;
  	  temp->rest_args = 1;
  	  break;
***************
*** 1540,1550 ****
  
  	for (otemp = temp->next; otemp != NULL; otemp = otemp->next)
  	  if (temp->length == otemp->length
! 	      && strncmp (temp->name, otemp->name, temp->length) == 0) {
  	      U_CHAR *name;
  
  	      name = (U_CHAR *) alloca (temp->length + 1);
! 	      (void) strncpy (name, temp->name, temp->length);
  	      name[temp->length] = '\0';
  	      cpp_error (pfile,
  			 "duplicate argument name `%s' in `#define'", name);
--- 1540,1550 ----
  
  	for (otemp = temp->next; otemp != NULL; otemp = otemp->next)
  	  if (temp->length == otemp->length
! 	      && strncmp ((const char *) temp->name, (const char *) otemp->name, temp->length) == 0) {
  	      U_CHAR *name;
  
  	      name = (U_CHAR *) alloca (temp->length + 1);
! 	      (void) strncpy ((char *) name, (const char *) temp->name, temp->length);
  	      name[temp->length] = '\0';
  	      cpp_error (pfile,
  			 "duplicate argument name `%s' in `#define'", name);
***************
*** 1648,1654 ****
      msg[sym_length] = 0;
      cpp_error (pfile, "invalid %s name `%s'", usage, msg);
    } else {
!     if (! strncmp (symname, "defined", 7) && sym_length == 7)
        cpp_error (pfile, "invalid %s name `defined'", usage);
    }
    return sym_length;
--- 1648,1654 ----
      msg[sym_length] = 0;
      cpp_error (pfile, "invalid %s name `%s'", usage, msg);
    } else {
!     if (! strncmp ((const char *) symname, "defined", 7) && sym_length == 7)
        cpp_error (pfile, "invalid %s name `defined'", usage);
    }
    return sym_length;
***************
*** 1673,1679 ****
      return 1;
    for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2;
         a1 = a1->next, a2 = a2->next) {
!     if (!((a1->nchars == a2->nchars && ! strncmp (p1, p2, a1->nchars))
  	  || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0))
  	|| a1->argno != a2->argno
  	|| a1->stringify != a2->stringify
--- 1673,1679 ----
      return 1;
    for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2;
         a1 = a1->next, a2 = a2->next) {
!     if (!((a1->nchars == a2->nchars && ! strncmp ((const char *) p1, (const char *) p2, a1->nchars))
  	  || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0))
  	|| a1->argno != a2->argno
  	|| a1->stringify != a2->stringify
***************
*** 1783,1789 ****
  	  *msg = '`';
  	  bcopy (mdef.symnam, msg + 1, mdef.symlen);
  	  strcpy ((char *) (msg + mdef.symlen + 1), "' redefined");
! 	  cpp_pedwarn (pfile, msg);
  	  if (hp->type == T_MACRO)
  	    cpp_pedwarn_with_file_and_line (pfile, hp->value.defn->file, hp->value.defn->line,
  				      "this is the location of the previous definition");
--- 1783,1789 ----
  	  *msg = '`';
  	  bcopy (mdef.symnam, msg + 1, mdef.symlen);
  	  strcpy ((char *) (msg + mdef.symlen + 1), "' redefined");
! 	  cpp_pedwarn (pfile, (const char *) msg);
  	  if (hp->type == T_MACRO)
  	    cpp_pedwarn_with_file_and_line (pfile, hp->value.defn->file, hp->value.defn->line,
  				      "this is the location of the previous definition");
***************
*** 2105,2111 ****
    }
  
    sprintf ((char *) CPP_PWRITTEN (pfile), "%ld ", line);
!   CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
  
    quote_string (pfile, ip->nominal_fname); 
    if (file_change != same_file) {
--- 2105,2111 ----
    }
  
    sprintf ((char *) CPP_PWRITTEN (pfile), "%ld ", line);
!   CPP_ADJUST_WRITTEN (pfile, strlen ((const char *) CPP_PWRITTEN (pfile)));
  
    quote_string (pfile, ip->nominal_fname); 
    if (file_change != same_file) {
***************
*** 3248,3254 ****
    /* If specified file name is absolute, just open it.  */
  
    if (*fbeg == '/') {
!     strncpy (fname, fbeg, flen);
      fname[flen] = 0;
      if (redundant_include_p (pfile, fname))
        return 0;
--- 3248,3254 ----
    /* If specified file name is absolute, just open it.  */
  
    if (*fbeg == '/') {
!     strncpy (fname, (const char *) fbeg, flen);
      fname[flen] = 0;
      if (redundant_include_p (pfile, fname))
        return 0;
***************
*** 3275,3281 ****
        } else {
  	fname[0] = 0;
        }
!       strncat (fname, fbeg, flen);
  #ifdef VMS
        /* Change this 1/2 Unix 1/2 VMS file specification into a
           full VMS file specification */
--- 3275,3281 ----
        } else {
  	fname[0] = 0;
        }
!       strncat (fname, (const char *) fbeg, flen);
  #ifdef VMS
        /* Change this 1/2 Unix 1/2 VMS file specification into a
           full VMS file specification */
***************
*** 3316,3322 ****
    if (f < 0)
      {
        /* A file that was not found.  */
!       strncpy (fname, fbeg, flen);
        fname[flen] = 0;
        /* If generating dependencies and -MG was specified, we assume missing
  	 files are leaf files, living in the same directory as the source file
--- 3316,3322 ----
    if (f < 0)
      {
        /* A file that was not found.  */
!       strncpy (fname, (const char *) fbeg, flen);
        fname[flen] = 0;
        /* If generating dependencies and -MG was specified, we assume missing
  	 files are leaf files, living in the same directory as the source file
***************
*** 3595,3601 ****
  
    bucket = pfile->assertion_hashtab[hash];
    while (bucket) {
!     if (bucket->length == len && strncmp (bucket->name, name, len) == 0)
        return bucket;
      bucket = bucket->next;
    }
--- 3595,3601 ----
  
    bucket = pfile->assertion_hashtab[hash];
    while (bucket) {
!     if (bucket->length == len && strncmp ((const char *) bucket->name, (const char *) name, len) == 0)
        return bucket;
      bucket = bucket->next;
    }
***************
*** 3776,3782 ****
      hash_bucket = &fname_table[hashf (fname, fname_length, FNAME_HASHSIZE)];
      for (hp = *hash_bucket; hp != NULL; hp = hp->next)
        if (hp->length == fname_length
! 	  && strncmp (hp->value.cpval, fname, fname_length) == 0) {
  	ip->nominal_fname = hp->value.cpval;
  	break;
        }
--- 3776,3782 ----
      hash_bucket = &fname_table[hashf (fname, fname_length, FNAME_HASHSIZE)];
      for (hp = *hash_bucket; hp != NULL; hp = hp->next)
        if (hp->length == fname_length
! 	  && strncmp (hp->value.cpval, (const char *) fname, fname_length) == 0) {
  	ip->nominal_fname = hp->value.cpval;
  	break;
        }
***************
*** 3959,3965 ****
  {
    while (*buf == ' ' || *buf == '\t')
      buf++;
!   if (!strncmp (buf, "once", 4)) {
      /* Allow #pragma once in system headers, since that's not the user's
         fault.  */
      if (!CPP_BUFFER (pfile)->system_header_p)
--- 3959,3965 ----
  {
    while (*buf == ' ' || *buf == '\t')
      buf++;
!   if (!strncmp ((const char *) buf, "once", 4)) {
      /* Allow #pragma once in system headers, since that's not the user's
         fault.  */
      if (!CPP_BUFFER (pfile)->system_header_p)
***************
*** 3967,3973 ****
      do_once (pfile, NULL, NULL, NULL);
    }
  
!   if (!strncmp (buf, "implementation", 14)) {
      /* Be quiet about `#pragma implementation' for a file only if it hasn't
         been included yet.  */
      struct file_name_list *ptr;
--- 3967,3973 ----
      do_once (pfile, NULL, NULL, NULL);
    }
  
!   if (!strncmp ((const char *) buf, "implementation", 14)) {
      /* Be quiet about `#pragma implementation' for a file only if it hasn't
         been included yet.  */
      struct file_name_list *ptr;
***************
*** 3978,3990 ****
        return 0;
  
      fname = p + 1;
!     p = (U_CHAR *) index (fname, '\"');
!     fname_len = p != NULL ? p - fname : strlen (fname);
      
      for (ptr = pfile->all_include_files; ptr; ptr = ptr->next) {
        inc_fname = (U_CHAR *) rindex (ptr->fname, '/');
        inc_fname = inc_fname ? inc_fname + 1 : (U_CHAR *) ptr->fname;
!       if (inc_fname && !strncmp (inc_fname, fname, fname_len))
  	cpp_warning (pfile,
  	   "`#pragma implementation' for `%s' appears after file is included",
  		     fname);
--- 3978,3990 ----
        return 0;
  
      fname = p + 1;
!     p = (U_CHAR *) index ((const char *) fname, '\"');
!     fname_len = p != NULL ? p - fname : strlen ((const char *) fname);
      
      for (ptr = pfile->all_include_files; ptr; ptr = ptr->next) {
        inc_fname = (U_CHAR *) rindex (ptr->fname, '/');
        inc_fname = inc_fname ? inc_fname + 1 : (U_CHAR *) ptr->fname;
!       if (inc_fname && !strncmp ((const char *) inc_fname, (const char *) fname, fname_len))
  	cpp_warning (pfile,
  	   "`#pragma implementation' for `%s' appears after file is included",
  		     fname);
***************
*** 4310,4316 ****
  	{
  	  IF_STACK_FRAME *temp;
  	  if (ident_length == kt->length
! 	      && strncmp (ident, kt->name, kt->length) == 0)
  	    {
  	      /* If we are asked to return on next directive, do so now.  */
  	      if (any)
--- 4310,4316 ----
  	{
  	  IF_STACK_FRAME *temp;
  	  if (ident_length == kt->length
! 	      && strncmp ((const char *) ident, kt->name, kt->length) == 0)
  	    {
  	      /* If we are asked to return on next directive, do so now.  */
  	      if (any)
***************
*** 5602,5608 ****
  
      /* Read the file contents, knowing that st_size is an upper bound
         on the number of bytes we can read.  */
!     length = safe_read (f, fp->buf, st_size);
      fp->rlimit = fp->buf + length;
      if (length < 0) goto nope;
    }
--- 5602,5608 ----
  
      /* Read the file contents, knowing that st_size is an upper bound
         on the number of bytes we can read.  */
!     length = safe_read (f, (char *) fp->buf, st_size);
      fp->rlimit = fp->buf + length;
      if (length < 0) goto nope;
    }
***************
*** 5621,5627 ****
      fp->buf = (U_CHAR *) xmalloc (bsize + 2);
  
      for (;;) {
!       i = safe_read (f, fp->buf + st_size, bsize - st_size);
        if (i < 0)
  	goto nope;      /* error! */
        st_size += i;
--- 5621,5627 ----
      fp->buf = (U_CHAR *) xmalloc (bsize + 2);
  
      for (;;) {
!       i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size);
        if (i < 0)
  	goto nope;      /* error! */
        st_size += i;
***************
*** 5749,5755 ****
  	  *p++= 0;
  	if (opts->debug_output)
  	  output_line_command (pfile, 0, same_file);
! 	cpp_define (pfile, q);
  	while (*p == ' ' || *p == '\t')
  	  p++;
        } else if (p[0] == '-' && p[1] == 'A') {
--- 5749,5755 ----
  	  *p++= 0;
  	if (opts->debug_output)
  	  output_line_command (pfile, 0, same_file);
! 	cpp_define (pfile, (unsigned char *) q);
  	while (*p == ' ' || *p == '\t')
  	  p++;
        } else if (p[0] == '-' && p[1] == 'A') {
***************
*** 5791,5797 ****
  	save_char = *termination;
  	*termination = '\0';
  	/* Install the assertion.  */
! 	make_assertion (pfile, "-A", assertion);
  	*termination = (char) save_char;
  	p = termination;
  	while (*p == ' ' || *p == '\t')
--- 5791,5797 ----
  	save_char = *termination;
  	*termination = '\0';
  	/* Install the assertion.  */
! 	make_assertion (pfile, "-A", (unsigned char *) assertion);
  	*termination = (char) save_char;
  	p = termination;
  	while (*p == ' ' || *p == '\t')
***************
*** 5817,5831 ****
  	    case 'U':
  	      if (opts->debug_output)
  		output_line_command (pfile, 0, same_file);
! 	      do_undef (pfile, NULL, pend->arg, pend->arg + strlen (pend->arg));
  	      break;
  	    case 'D':
  	      if (opts->debug_output)
  		output_line_command (pfile, 0, same_file);
! 	      cpp_define (pfile, pend->arg);
  	      break;
  	    case 'A':
! 	      make_assertion (pfile, "-A", pend->arg);
  	      break;
  	    }
  	}
--- 5817,5831 ----
  	    case 'U':
  	      if (opts->debug_output)
  		output_line_command (pfile, 0, same_file);
! 	      do_undef (pfile, NULL, (unsigned char *) pend->arg, (unsigned char *) pend->arg + strlen (pend->arg));
  	      break;
  	    case 'D':
  	      if (opts->debug_output)
  		output_line_command (pfile, 0, same_file);
! 	      cpp_define (pfile, (unsigned char *) pend->arg);
  	      break;
  	    case 'A':
! 	      make_assertion (pfile, "-A", (unsigned char *) pend->arg);
  	      break;
  	    }
  	}
***************
*** 6893,6899 ****
  
      hp = assertion_lookup (pfile, symname, sym_length, hashcode);
      if (hp == NULL) {
!       if (sym_length == 7 && ! strncmp (symname, "defined", sym_length))
  	cpp_error (pfile, "`defined' redefined as assertion");
        hp = assertion_install (pfile, symname, sym_length, hashcode);
      }
--- 6893,6899 ----
  
      hp = assertion_lookup (pfile, symname, sym_length, hashcode);
      if (hp == NULL) {
!       if (sym_length == 7 && ! strncmp ((const char *) symname, "defined", sym_length))
  	cpp_error (pfile, "`defined' redefined as assertion");
        hp = assertion_install (pfile, symname, sym_length, hashcode);
      }
***************
*** 7056,7062 ****
    while (l1 && l2) {
      if (l1->length != l2->length)
        return 0;
!     if (strncmp (l1->name, l2->name, l1->length))
        return 0;
      l1 = l1->next;
      l2 = l2->next;
--- 7056,7062 ----
    while (l1 && l2) {
      if (l1->length != l2->length)
        return 0;
!     if (strncmp ((const char *) l1->name, (const char *) l2->name, l1->length))
        return 0;
      l1 = l1->next;
      l2 = l2->next;
Index: gcc/expmed.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/expmed.c,v
retrieving revision 1.14
diff -c -r1.14 expmed.c
*** expmed.c	1998/05/06 21:06:58	1.14
--- expmed.c	1998/05/25 07:58:34
***************
*** 2449,2455 ****
        nl = (unsigned HOST_WIDE_INT) 1 << pow;
      }
    div_and_round_double (TRUNC_DIV_EXPR, 1, nl, nh, d, (HOST_WIDE_INT) 0,
! 			&mlow_lo, &mlow_hi, &dummy1, &dummy2);
  
    /* mhigh = (2^(N + lgup) + 2^N + lgup - precision)/d */
    if (pow2 >= HOST_BITS_PER_WIDE_INT)
--- 2449,2455 ----
        nl = (unsigned HOST_WIDE_INT) 1 << pow;
      }
    div_and_round_double (TRUNC_DIV_EXPR, 1, nl, nh, d, (HOST_WIDE_INT) 0,
! 			(int *) &mlow_lo, (int *) &mlow_hi, (int *) &dummy1, (int *) &dummy2);
  
    /* mhigh = (2^(N + lgup) + 2^N + lgup - precision)/d */
    if (pow2 >= HOST_BITS_PER_WIDE_INT)
***************
*** 2457,2463 ****
    else
      nl |= (unsigned HOST_WIDE_INT) 1 << pow2;
    div_and_round_double (TRUNC_DIV_EXPR, 1, nl, nh, d, (HOST_WIDE_INT) 0,
! 			&mhigh_lo, &mhigh_hi, &dummy1, &dummy2);
  
    if (mhigh_hi && nh - d >= d)
      abort ();
--- 2457,2463 ----
    else
      nl |= (unsigned HOST_WIDE_INT) 1 << pow2;
    div_and_round_double (TRUNC_DIV_EXPR, 1, nl, nh, d, (HOST_WIDE_INT) 0,
! 			(int *) &mhigh_lo, (int *) &mhigh_hi, (int *) &dummy1, (int *) &dummy2);
  
    if (mhigh_hi && nh - d >= d)
      abort ();
Index: gcc/fix-header.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/fix-header.c,v
retrieving revision 1.13
diff -c -r1.13 fix-header.c
*** fix-header.c	1998/05/19 08:42:26	1.13
--- fix-header.c	1998/05/25 07:58:36
***************
*** 393,399 ****
       const char *name;
       int name_length;
  {
!   int i = hashf (name, name_length, HASH_SIZE);
    int i0 = i;
    for (;;)
      {
--- 393,399 ----
       const char *name;
       int name_length;
  {
!   int i = hashf ((const unsigned char *) name, name_length, HASH_SIZE);
    int i0 = i;
    for (;;)
      {
***************
*** 616,622 ****
  {
    while (*names)
      {
!       if (cpp_lookup (pfile, names, -1, -1))
  	recognized_macro (names);
        names += strlen (names) + 1;
      }
--- 616,622 ----
  {
    while (*names)
      {
!       if (cpp_lookup (pfile, (const unsigned char *) names, -1, -1))
  	recognized_macro (names);
        names += strlen (names) + 1;
      }
***************
*** 666,672 ****
      {
        static char getchar_call[] = "getchar();";
        cpp_buffer *buf
! 	= cpp_push_buffer (&scan_in, getchar_call, sizeof(getchar_call) - 1);
        int old_written = CPP_WRITTEN (&scan_in);
        int seen_filbuf = 0;
  
--- 666,672 ----
      {
        static char getchar_call[] = "getchar();";
        cpp_buffer *buf
! 	= cpp_push_buffer (&scan_in, (unsigned char *) getchar_call, sizeof(getchar_call) - 1);
        int old_written = CPP_WRITTEN (&scan_in);
        int seen_filbuf = 0;
  
***************
*** 684,690 ****
  	      break;
  	    }
  	  if (token == CPP_NAME && length == 7
! 	      && strcmp ("_filbuf", scan_in.token_buffer + old_written) == 0)
  	    seen_filbuf++;
  	}
        if (seen_filbuf)
--- 684,690 ----
  	      break;
  	    }
  	  if (token == CPP_NAME && length == 7
! 	      && strcmp ("_filbuf", (const char *) scan_in.token_buffer + old_written) == 0)
  	    seen_filbuf++;
  	}
        if (seen_filbuf)
Index: gcc/gen-protos.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/gen-protos.c,v
retrieving revision 1.6
diff -c -r1.6 gen-protos.c
*** gen-protos.c	1998/05/19 08:42:30	1.6
--- gen-protos.c	1998/05/25 07:58:37
***************
*** 50,56 ****
    int i, i0;
  
    /* NOTE:  If you edit this, also edit lookup_std_proto in fix-header.c !! */
!   i = hashf (fname, strlen (fname), HASH_SIZE);
    i0 = i;
    if (hash_tab[i] != 0)
      {
--- 50,56 ----
    int i, i0;
  
    /* NOTE:  If you edit this, also edit lookup_std_proto in fix-header.c !! */
!   i = hashf ((const unsigned char *) fname, strlen (fname), HASH_SIZE);
    i0 = i;
    if (hash_tab[i] != 0)
      {
Index: gcc/scan-decls.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/scan-decls.c,v
retrieving revision 1.7
diff -c -r1.7 scan-decls.c
*** scan-decls.c	1998/05/19 08:42:42	1.7
--- scan-decls.c	1998/05/25 07:58:59
***************
*** 151,162 ****
  		  else if (token == CPP_NAME || token == CPP_3DOTS)
  		    have_arg_list = 1;
  		}
! 	      recognized_function (pfile->token_buffer + prev_id_start,
  				   prev_id_end - prev_id_start,
  				   (saw_inline ? 'I'
  				    : in_extern_C_brace || current_extern_C
  				    ? 'F' : 'f'),
! 				   pfile->token_buffer, prev_id_start,
  				   have_arg_list,
  				   fbuf->nominal_fname, func_lineno);
  	      token = cpp_get_non_space_token (pfile);
--- 151,162 ----
  		  else if (token == CPP_NAME || token == CPP_3DOTS)
  		    have_arg_list = 1;
  		}
! 	      recognized_function ((char *) pfile->token_buffer + prev_id_start,
  				   prev_id_end - prev_id_start,
  				   (saw_inline ? 'I'
  				    : in_extern_C_brace || current_extern_C
  				    ? 'F' : 'f'),
! 				   (char *) pfile->token_buffer, prev_id_start,
  				   have_arg_list,
  				   fbuf->nominal_fname, func_lineno);
  	      token = cpp_get_non_space_token (pfile);
***************
*** 181,189 ****
  	case CPP_SEMICOLON:
  	  if (prev_id_start && saw_extern)
  	    {
! 	      recognized_extern (pfile->token_buffer + prev_id_start,
  				 prev_id_end - prev_id_start,
! 				 pfile->token_buffer,
  				 prev_id_start);
  	    }
  	  /* ... fall through ...  */
--- 181,189 ----
  	case CPP_SEMICOLON:
  	  if (prev_id_start && saw_extern)
  	    {
! 	      recognized_extern ((char *) pfile->token_buffer + prev_id_start,
  				 prev_id_end - prev_id_start,
! 				 (char *) pfile->token_buffer,
  				 prev_id_start);
  	    }
  	  /* ... fall through ...  */
***************
*** 199,216 ****
  	  break;
  	case CPP_NAME:
  	  /* "inline" and "extern" are recognized but skipped */
! 	  if (strcmp (pfile->token_buffer, "inline") == 0)
  	    {
  	      saw_inline = 1;
  	      CPP_SET_WRITTEN (pfile, start_written);
  	    }
! 	  if (strcmp (pfile->token_buffer, "extern") == 0)
  	    {
  	      saw_extern = 1;
  	      CPP_SET_WRITTEN (pfile, start_written);
  	      token = cpp_get_non_space_token (pfile);
  	      if (token == CPP_STRING
! 		  && strcmp (pfile->token_buffer, "\"C\"") == 0)
  		{
  		  CPP_SET_WRITTEN (pfile, start_written);
  		  current_extern_C = 1;
--- 199,216 ----
  	  break;
  	case CPP_NAME:
  	  /* "inline" and "extern" are recognized but skipped */
! 	  if (strcmp ((const char *) pfile->token_buffer, "inline") == 0)
  	    {
  	      saw_inline = 1;
  	      CPP_SET_WRITTEN (pfile, start_written);
  	    }
! 	  if (strcmp ((const char *) pfile->token_buffer, "extern") == 0)
  	    {
  	      saw_extern = 1;
  	      CPP_SET_WRITTEN (pfile, start_written);
  	      token = cpp_get_non_space_token (pfile);
  	      if (token == CPP_STRING
! 		  && strcmp ((const char *) pfile->token_buffer, "\"C\"") == 0)
  		{
  		  CPP_SET_WRITTEN (pfile, start_written);
  		  current_extern_C = 1;



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