Re: [RFA] Add la_getstr member to language_defn

Thiago Jung Bauermann
2009-02-03T13:02:20Z

El lun, 02-02-2009 a las 16:23 -0800, Joel Brobecker escribiÃ³:
> > The patch doesn't apply anymore. This is the same patch, refreshed
> > against HEAD as of Dec 28th. Ok?
>
> Just a few comments and questions in addition to Tom's comments...

Great. Thanks!

> > + if ((TYPE_NFIELDS (type) == 1)
> > + && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE)
>
> The extra parens around "TYPE_NFIELDS (type) == 1" shouldn't be
> necessary, right? In this case, it's pretty harmless, but a little
> bit below, this really starts making it hard to read a condition...

Right. Changed.

> > + if (((VALUE_LVAL (value) == not_lval)
> > + || (VALUE_LVAL (value) == lval_internalvar)) && (fetchlimit != UINT_MAX))
>
> Can this be formatted as follow:
>
> if ((VALUE_LVAL (value) == not_lval
> || VALUE_LVAL (value) == lval_internalvar)
> && fetchlimit != UINT_MAX)
>
> ? (assuming my reading is correct!) The reason I like my suggestion
> is because there are less parentheses, so it's easier to match them
> without using my favorite editor; also, the formatting makes it clear
> at which level the || and the && operators are.

Changed.

> > + if ((TYPE_CODE (element_type) != TYPE_CODE_INT)
> > + && (TYPE_CODE (element_type) != TYPE_CODE_CHAR))
>
> Same here.

Ok.

> > @@ -511,6 +626,7 @@ const struct language_defn minimal_language_defn =
> > c_language_arch_info,
> > default_print_array_index,
> > default_pass_by_reference,
> > + default_get_string,
> > LANG_MAGIC
> > };
>
> I was wondering if it wouldn't be more useful to use the c_get_string
> function as the default rather than the default_get_string stub.
> What do you guys think?

I don't have an opinion here, since I know little about how other
languages represent strings...
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center