This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc][05/37] Eliminate builtin_type_ macros: Replace LA_BOOL_TYPE macro
- From: Joel Brobecker <brobecker at adacore dot com>
- To: uweigand at de dot ibm dot com
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 5 Sep 2008 11:07:19 -0700
- Subject: Re: [rfc][05/37] Eliminate builtin_type_ macros: Replace LA_BOOL_TYPE macro
- References: <20080831175045.128504000@de.ibm.com> <20080831175119.299740000@de.ibm.com>
> * language.c (lang_bool_type): Remove.
> (language_bool_type): New function.
I was hoping we could cache the boolean type, but I guess it can get
stale every time we load or unload a symbol file...
> case TYPE_CODE_RANGE:
> arg2 = value_from_longest (builtin_type_int, TYPE_LOW_BOUND (type));
> arg3 = value_from_longest (builtin_type_int,
> TYPE_HIGH_BOUND (type));
> + type = language_bool_type (exp->language_defn, exp->gdbarch);
> return
> - value_from_longest (builtin_type_int,
> + value_from_longest (type,
> (value_less (arg1, arg3)
> || value_equal (arg1, arg3))
> && (value_less (arg2, arg1)
Nice improvement - the returning of a boolean type instead of an int :).
It should transform:
(gdb) print 2 in 1 .. 3
$1 = 1
Hopefully into:`
(gdb) print 2 in 1 .. 3
$1 = true
Thanks!
Your patch also allowed me to notice something else: I also think that
I'll explore the idea of using value_in() instead of the combination of
value_less/value_equal/[...]. Separate patch, though.
No further comment, your honor...
--
Joel