From: "Nick Kelsey" <nickk@ubicom.com>
To: <cgen@sources.redhat.com>
Subject: Re: Problem with keyword parsing for gas
Date: Wed, 18 Dec 2002 11:42:00 -0000 [thread overview]
Message-ID: <0f1001c2a6cd$a12be470$f601a8c0@nkelseyxp> (raw)
In-Reply-To: <redirect-4850146@silicondust.com>
[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]
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.
Nick
----- Original Message -----
From: "Nick Kelsey" <nickk@ubicom.com>
To: <jafa@silicondust.com>
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 == '_'))
++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)))
++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
pre-initialized...
CGEN_KEYWORD xxx_cgen_opval_register_names =
{
& xxx_cgen_opval_register_names_entries[0],
121,
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.
Thanks
Nick
[-- Attachment #2: gas_cgen_parse.patch --]
[-- Type: application/octet-stream, Size: 709 bytes --]
*** cgen-asm.c 26 Nov 2002 18:12:48 -0000
--- cgen-asm.c 18 Dec 2002 02:16:00 -0000
*************** cgen_parse_keyword (cd, strp, keyword_ta
*** 225,231 ****
/* Allow letters, digits, and any special characters. */
while (((p - start) < (int) sizeof (buf))
&& *p
! && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p)))
++p;
if (p - start >= (int) sizeof (buf))
--- 225,233 ----
/* Allow letters, digits, and any special characters. */
while (((p - start) < (int) sizeof (buf))
&& *p
! && (ISALNUM (*p) ||
! strchr (keyword_table->nonalpha_chars, *p) ||
! *p == '_'))
++p;
if (p - start >= (int) sizeof (buf))
[-- Attachment #3: ChangeLog --]
[-- Type: application/octet-stream, Size: 192 bytes --]
2002-12-18 Nick Kelsey <nickk@ubicom.com>
* cgen-asm.c (cgen_parse_keyword): Added underscore to symbol character
check to fix false keyword trigger with names such as <keyword>_foo.
next parent reply other threads:[~2002-12-18 19:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redirect-4850146@silicondust.com>
2002-12-18 11:42 ` Nick Kelsey [this message]
2002-12-17 18:03 Nick Kelsey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='0f1001c2a6cd$a12be470$f601a8c0@nkelseyxp' \
--to=nickk@ubicom.com \
--cc=cgen@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).