public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Committed: Update tc-microblaze.c to use safe-ctype.h
@ 2009-08-17  9:24 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2009-08-17  9:24 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

Hi Guys,

  I am applying the patch below to change the recently contributed
  tc-microblaze.c file over from using <ctype.h> to using
  "safe-ctype.h".

Cheers
  Nick

gas/ChangeLog
2009-08-17  Nick Clifton  <nickc@redhat.com>

	* config/tc-microblaze.c: Include safe-ctype.h instead of ctype.h.
	(parse_reg): Use safe-ctype.h macros.
	(parse_exp): Likewise.
	(md_assemble): Likewise.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tc-microblaze.c.patch --]
[-- Type: text/x-patch, Size: 4986 bytes --]

Index: gas/config/tc-microblaze.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-microblaze.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 tc-microblaze.c
*** gas/config/tc-microblaze.c	6 Aug 2009 17:38:02 -0000	1.1
--- gas/config/tc-microblaze.c	17 Aug 2009 09:05:28 -0000
***************
*** 26,32 ****
  #define DEFINE_TABLE
  #include "../opcodes/microblaze-opc.h"
  #include "../opcodes/microblaze-opcm.h"
! #include <ctype.h>
  #include <string.h>
  #include <dwarf2dbg.h>
  #include "aout/stab_gnu.h"
--- 26,32 ----
  #define DEFINE_TABLE
  #include "../opcodes/microblaze-opc.h"
  #include "../opcodes/microblaze-opcm.h"
! #include "safe-ctype.h"
  #include <string.h>
  #include <dwarf2dbg.h>
  #include "aout/stab_gnu.h"
*************** parse_reg (char * s, unsigned * reg)
*** 409,415 ****
    unsigned tmpreg = 0;
  
    /* Strip leading whitespace.  */
!   while (isspace (* s))
      ++ s;
  
    if (strncasecmp (s, "rpc", 3) == 0)
--- 409,415 ----
    unsigned tmpreg = 0;
  
    /* Strip leading whitespace.  */
!   while (ISSPACE (* s))
      ++ s;
  
    if (strncasecmp (s, "rpc", 3) == 0)
*************** parse_reg (char * s, unsigned * reg)
*** 481,493 ****
    /* MMU registers end.  */
    else if (strncasecmp (s, "rpvr", 4) == 0)
      {
!       if (isdigit (s[4]) && isdigit (s[5]))
          {
            tmpreg = (s[4]-'0')*10 + s[5] - '0';
            s += 6;
          }
  
!       else if (isdigit (s[4]))
          {
            tmpreg = s[4] - '0';
            s += 5;
--- 481,493 ----
    /* MMU registers end.  */
    else if (strncasecmp (s, "rpvr", 4) == 0)
      {
!       if (ISDIGIT (s[4]) && ISDIGIT (s[5]))
          {
            tmpreg = (s[4]-'0')*10 + s[5] - '0';
            s += 6;
          }
  
!       else if (ISDIGIT (s[4]))
          {
            tmpreg = s[4] - '0';
            s += 5;
*************** parse_reg (char * s, unsigned * reg)
*** 510,521 ****
      }
    else if (strncasecmp (s, "rfsl", 4) == 0)
      {
!       if (isdigit (s[4]) && isdigit (s[5]))
          {
            tmpreg = (s[4] - '0') * 10 + s[5] - '0';
            s += 6;
          }
!       else if (isdigit (s[4]))
          {
            tmpreg = s[4] - '0';
            s += 5;
--- 510,521 ----
      }
    else if (strncasecmp (s, "rfsl", 4) == 0)
      {
!       if (ISDIGIT (s[4]) && ISDIGIT (s[5]))
          {
            tmpreg = (s[4] - '0') * 10 + s[5] - '0';
            s += 6;
          }
!       else if (ISDIGIT (s[4]))
          {
            tmpreg = s[4] - '0';
            s += 5;
*************** parse_reg (char * s, unsigned * reg)
*** 523,529 ****
        else
  	as_bad (_("register expected, but saw '%.6s'"), s);
  
!       if ((int)tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
          *reg = tmpreg;
        else
  	{
--- 523,529 ----
        else
  	as_bad (_("register expected, but saw '%.6s'"), s);
  
!       if ((int) tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
          *reg = tmpreg;
        else
  	{
*************** parse_reg (char * s, unsigned * reg)
*** 534,547 ****
      }
    else
      {
!       if (tolower (s[0]) == 'r')
          {
!           if (isdigit (s[1]) && isdigit (s[2]))
              {
                tmpreg = (s[1] - '0') * 10 + s[2] - '0';
                s += 3;
              }
!           else if (isdigit (s[1]))
              {
                tmpreg = s[1] - '0';
                s += 2;
--- 534,547 ----
      }
    else
      {
!       if (TOLOWER (s[0]) == 'r')
          {
!           if (ISDIGIT (s[1]) && ISDIGIT (s[2]))
              {
                tmpreg = (s[1] - '0') * 10 + s[2] - '0';
                s += 3;
              }
!           else if (ISDIGIT (s[1]))
              {
                tmpreg = s[1] - '0';
                s += 2;
*************** parse_exp (char *s, expressionS *e)
*** 571,577 ****
    char *new;
  
    /* Skip whitespace.  */
!   while (isspace (* s))
      ++ s;
  
    save = input_line_pointer;
--- 571,577 ----
    char *new;
  
    /* Skip whitespace.  */
!   while (ISSPACE (* s))
      ++ s;
  
    save = input_line_pointer;
*************** md_assemble (char * str)
*** 806,812 ****
    char name[20];
  
    /* Drop leading whitespace.  */
!   while (isspace (* str))
      str ++;
  
    /* Find the op code end.  */
--- 806,812 ----
    char name[20];
  
    /* Drop leading whitespace.  */
!   while (ISSPACE (* str))
      str ++;
  
    /* Find the op code end.  */
*************** md_assemble (char * str)
*** 1612,1618 ****
      }
  
    /* Drop whitespace after all the operands have been parsed.  */
!   while (isspace (* op_end))
      op_end ++;
  
    /* Give warning message if the insn has more operands than required.  */
--- 1612,1618 ----
      }
  
    /* Drop whitespace after all the operands have been parsed.  */
!   while (ISSPACE (* op_end))
      op_end ++;
  
    /* Give warning message if the insn has more operands than required.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-17  9:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-17  9:24 Committed: Update tc-microblaze.c to use safe-ctype.h Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).