This is the mail archive of the mailing list for the CGEN 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: Problem with keyword parsing for gas

After sleeping on this I have come to the conclusing that an underscore
should always be considered a symbol character regardless how weird the port
is so I have submitted the attached patch to binutils for review.


----- Original Message -----
From: "Nick Kelsey" <>
To: <>
Sent: Tuesday, December 17, 2002 6:03 PM
Subject: Problem with keyword parsing for gas

*This message was transferred with a trial version of CommuniGate(tm) Pro*
Hi guys,

A change was made to cgen in mid 2001 that affects keyword parsing....

opcodes/cgen-asm.c (early 2001): cgen_parse_keyword:

  /* Now allow letters, digits, and _.  */
  while (((p - start) < (int) sizeof (buf))
  && (isalnum ((unsigned char) *p) || *p == '_'))

This would correctly treat <keyword>_temp as a non keyword.

The new code reads as follows:

  /* Allow letters, digits, and any special characters.  */
  while (((p - start) < (int) sizeof (buf))
  && *p
  && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p)))

This does not treat an underscore as a symbol character and gas barfs on a
symbol that starts <keyword>underscore.

Possible solutions that spring to mind... Add an explicit check for
underscore to the while statement, or add an underscore to nonalpha_chars.

Adding an underscore to nonalpha_chars is easy as it is global and

CGEN_KEYWORD xxx_cgen_opval_register_names =
  & xxx_cgen_opval_register_names_entries[0],
  0, 0, 0, 0, "_"

However this is generated code so there are bigger implications.

I am completly open to suggestions and implications as to the best way to
fix this without breaking other ports.



Attachment: gas_cgen_parse.patch
Description: Binary data

Attachment: ChangeLog
Description: Binary data

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