summaryrefslogtreecommitdiffstats
path: root/gcc/genattrtab.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-12 18:43:33 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-12 18:43:33 +0000
commitbe46690ee3370d9008b0220bfa7074563edd7ded (patch)
tree041a0c07e04b7b1e912cc3fbfff87c4cb5742d5e /gcc/genattrtab.c
parent0ef911744f03203291e910fd511fc5fbe17b692f (diff)
downloadppe42-gcc-be46690ee3370d9008b0220bfa7074563edd7ded.tar.gz
ppe42-gcc-be46690ee3370d9008b0220bfa7074563edd7ded.zip
* gensupport.c (n_comma_elts): Moved here from genattrtab.c.
(scan_comma_elt): New function. Accepts whitespace in comma lists. * gensupport.h: Prototype new routines. * genattr.c (gen_attr): Use scan_comma_elt. Avoid unnecessary use of printf. * genattrtab.c (n_comma_elts): Moved to gensupport.c. (next_comma_elt): Use scan_comma_elt. * config/i386/i386.md: Use new attribute notation to break up long lines in define_attr forms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53403 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genattrtab.c')
-rw-r--r--gcc/genattrtab.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 2e2b0015034..1561e77218d 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -456,7 +456,6 @@ static void write_complex_function PARAMS ((struct function_unit *, const char *
static int write_expr_attr_cache PARAMS ((rtx, struct attr_desc *));
static void write_toplevel_expr PARAMS ((rtx));
static void write_const_num_delay_slots PARAMS ((void));
-static int n_comma_elts PARAMS ((const char *));
static char *next_comma_elt PARAMS ((const char **));
static struct attr_desc *find_attr PARAMS ((const char *, int));
static struct attr_value *find_most_used PARAMS ((struct attr_desc *));
@@ -5793,25 +5792,6 @@ write_complex_function (unit, name, connection)
/* This page contains miscellaneous utility routines. */
-/* Given a string, return the number of comma-separated elements in it.
- Return 0 for the null string. */
-
-static int
-n_comma_elts (s)
- const char *s;
-{
- int n;
-
- if (*s == '\0')
- return 0;
-
- for (n = 1; *s; s++)
- if (*s == ',')
- n++;
-
- return n;
-}
-
/* Given a pointer to a (char *), return a malloc'ed string containing the
next comma-separated element. Advance the pointer to after the string
scanned, or the end-of-string. Return NULL if at end of string. */
@@ -5820,23 +5800,14 @@ static char *
next_comma_elt (pstr)
const char **pstr;
{
- char *out_str;
- const char *p;
-
- if (**pstr == '\0')
- return NULL;
-
- /* Find end of string to compute length. */
- for (p = *pstr; *p != ',' && *p != '\0'; p++)
- ;
+ const char *start;
- out_str = attr_string (*pstr, p - *pstr);
- *pstr = p;
+ start = scan_comma_elt (pstr);
- if (**pstr == ',')
- (*pstr)++;
+ if (start == NULL)
+ return NULL;
- return out_str;
+ return attr_string (start, *pstr - start);
}
/* Return a `struct attr_desc' pointer for a given named attribute. If CREATE
OpenPOWER on IntegriCloud