This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
patch - fix false keyword triggering in gas with cgen targets
- From: Doug Evans <dje at transmeta dot com>
- To: "Nick Kelsey" <nickk at ubicom dot com>
- Cc: <binutils at sources dot redhat dot com>, cgen at sources dot redhat dot com
- Date: Wed, 18 Dec 2002 12:47:03 -0800 (PST)
- Subject: patch - fix false keyword triggering in gas with cgen targets
- References: <0eee01c2a6cc$0d5d4230$f601a8c0@nkelseyxp>
Nick Kelsey writes:
> Hi all,
>
> Attached is patch to fix flase keyword triggering in gas with symbols such
> as <register name>_foo.
An equivalent solution is to move the '_' to desc.scm and either
make it a default nonalpha_char or hardcode it as always being
a nonalpha_char.
However, I like changing cgen-asm.c better. '_' is typically a
legit symbol char so better to bubble it up to the top and treat
it like alnum's.
I'm assuming of course this doesn't break existing ports.
Given that the '_' was there for a long time I think it is
a safe assumption, but still an assumption nonetheless.
If down the road we ever have to revisit this decision we
can move '_' to desc.scm and make it the default.
---
Nit though. GNU coding standard say the || goes at the beginning
of the next line. The way I remember this is that English reads as
"if foo, or bar, or baz"
not
"if foo or, bar or, baz"
*** 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))