This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: Binutils Port - Infineon xc16x family.


Hi Shrirang,

Please find the patch with this mail for xc16x.opc file.

Sorry, I am confused. You are changing a function like this:


  static const char *
  parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
	    const char **strp,
	    int opindex ATTRIBUTE_UNUSED,
	    long *valuep ATTRIBUTE_UNUSED)
  {
    if (**strp == '#')
      ++*strp;
    return NULL;
  }

To this:

  static const char *
  parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
	    const char **strp,
	    int opindex ATTRIBUTE_UNUSED,
	    long *valuep ATTRIBUTE_UNUSED)
  {
    if (**strp == '#')
      {
        ++*strp;
        return NULL;
      }
  }

Correct ? And you say that this *fixes* a bug ? How is this possible ? If the value pointed to by **strp is not a '#' character then what is the function supposed to return ?

Surely you want the patch to produce a function something like this ?

  static const char *
  parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
	    const char **strp,
	    int opindex ATTRIBUTE_UNUSED,
	    long *valuep ATTRIBUTE_UNUSED)
  {
    if (**strp == '#')
      {
        ++*strp;
        return NULL;
      }
    return _("Missing '#' prefix");
  }

ie I think that your patch really ought to look like the attached file. What do you think ?

cgen/ChangeLog
2006-03-03 Shrirang Khisti <shrirangk@kpitcummins.com)

	* xc16x.opc (parse_hash): Return NULL if the input was parsed or
        an error message otherwise.
	(parse_dot, parse_pof, parse_pag, parse_sof, parse_seg):
        Likewise.
	Fix up comments to correctly describe the functions.

opcodes/ChangeLog
2006-03-03 Shrirang Khisti <shrirangk@kpitcummins.com)

	* xc16x-asm.c: Regenerate.
	* xc16x-dis.c: Regenerate.
	* xc16x-ibld.c: Regenerate.

Cheers
  Nick
Index: cgen/cpu/xc16x.opc
===================================================================
RCS file: /cvs/src/src/cgen/cpu/xc16x.opc,v
retrieving revision 1.1
diff -c -3 -p -r1.1 xc16x.opc
*** cgen/cpu/xc16x.opc	17 Feb 2006 14:36:22 -0000	1.1
--- cgen/cpu/xc16x.opc	3 Mar 2006 14:22:13 -0000
*************** parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_U
*** 59,66 ****
  	    long *valuep ATTRIBUTE_UNUSED)
  {
    if (**strp == '#')
!     ++*strp;
!   return NULL;
  }
  
  /* Handle '.' prefixes (i.e. skip over them).  */
--- 59,69 ----
  	    long *valuep ATTRIBUTE_UNUSED)
  {
    if (**strp == '#')
!     {
!       ++*strp;
!       return NULL;
!     }
!   return _("Missing '#' prefix");
  }
  
  /* Handle '.' prefixes (i.e. skip over them).  */
*************** parse_dot (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 72,82 ****
  	   long *valuep ATTRIBUTE_UNUSED)
  {
    if (**strp == '.')
!     ++*strp;
!   return NULL;
  }
  
! /* Handle '.' prefixes (i.e. skip over them).  */
  
  static const char *
  parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 75,88 ----
  	   long *valuep ATTRIBUTE_UNUSED)
  {
    if (**strp == '.')
!     {
!       ++*strp;
!       return NULL;
!     }
!   return _("Missing '.' prefix");
  }
  
! /* Handle 'pof:' prefixes (i.e. skip over them).  */
  
  static const char *
  parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
*************** parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 84,95 ****
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (!strncasecmp (*strp, "pof:", 4))
!     *strp += 4;
!   return NULL;
  }
  
! /* Handle '.' prefixes (i.e. skip over them).  */
  
  static const char *
  parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 90,104 ----
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (strncasecmp (*strp, "pof:", 4) == 0)
!     {
!       *strp += 4;
!       return NULL;
!     }
!   return _("Missing 'pof:' prefix");  
  }
  
! /* Handle 'pag:' prefixes (i.e. skip over them).  */
  
  static const char *
  parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
*************** parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 97,129 ****
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (!strncasecmp (*strp, "pag:", 4))
!     *strp += 4;
!   return NULL;
  }
  
  /* Handle 'sof' prefixes (i.e. skip over them).  */
  static const char *
  parse_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
  	   const char **strp,
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (!strncasecmp (*strp, "sof:", 4))
!     *strp += 4;
!   return NULL;
  }
  
  /* Handle 'seg' prefixes (i.e. skip over them).  */
  static const char *
  parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
  	   const char **strp,
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (!strncasecmp (*strp, "seg:", 4))
!     *strp += 4;
!   return NULL;
  }
  /* -- */
  
--- 106,149 ----
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (strncasecmp (*strp, "pag:", 4) == 0)
!     {
!       *strp += 4;
!       return NULL;
!     }
!   return _("Missing 'pag:' prefix");
  }
  
  /* Handle 'sof' prefixes (i.e. skip over them).  */
+ 
  static const char *
  parse_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
  	   const char **strp,
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (strncasecmp (*strp, "sof:", 4) == 0)
!     {
!       *strp += 4;
!       return NULL;
!     }
!   return _("Missing 'sof:' prefix");
  }
  
  /* Handle 'seg' prefixes (i.e. skip over them).  */
+ 
  static const char *
  parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
  	   const char **strp,
  	   int opindex ATTRIBUTE_UNUSED,
  	   long *valuep ATTRIBUTE_UNUSED)
  {
!   if (strncasecmp (*strp, "seg:", 4) == 0)
!     {
!       *strp += 4;
!       return NULL;
!     }
!   return _("Missing 'seg:' prefix");
  }
  /* -- */
  
*************** parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 141,147 ****
      }								\
    while (0)
  
! /* Handle '.' prefixes as operands.  */
  
  static void
  print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 161,167 ----
      }								\
    while (0)
  
! /* Print a 'pof:' prefix to an operand.  */
  
  static void
  print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
*************** print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 153,159 ****
  {
  }
  
! /* Handle '.' prefixes as operands.  */
  
  static void
  print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 173,179 ----
  {
  }
  
! /* Print a 'pag:' prefix to an operand.  */
  
  static void
  print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
*************** print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 165,171 ****
  {
  }
  
! /* Handle '.' prefixes as operands.  */
  
  static void
  print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 185,191 ----
  {
  }
  
! /* Print a 'sof:' prefix to an operand.  */
  
  static void
  print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
*************** print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 180,186 ****
    info->fprintf_func (info->stream, "sof:");
  }
  
! /* Handle '.' prefixes as operands.  */
  
  static void
  print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 200,206 ----
    info->fprintf_func (info->stream, "sof:");
  }
  
! /* Print a 'seg:' prefix to an operand.  */
  
  static void
  print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
*************** print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UN
*** 195,201 ****
    info->fprintf_func (info->stream, "seg:");
  }
  
! /* Handle '#' prefixes as operands.  */
  
  static void
  print_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 215,221 ----
    info->fprintf_func (info->stream, "seg:");
  }
  
! /* Print a '#' prefix to an operand.  */
  
  static void
  print_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
*************** print_hash (CGEN_CPU_DESC cd ATTRIBUTE_U
*** 210,216 ****
    info->fprintf_func (info->stream, "#");
  }
  
! /* Handle '.' prefixes as operands.  */
  
  static void
  print_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
--- 230,236 ----
    info->fprintf_func (info->stream, "#");
  }
  
! /* Print a '.' prefix to an operand.  */
  
  static void
  print_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,

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