This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Type-safe wrapper for enum flags
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Fri, 30 Oct 2015 14:52:37 +0000
- Subject: Re: [PATCH] Type-safe wrapper for enum flags
- Authentication-results: sourceware.org; auth=none
- References: <1446144341-21267-1-git-send-email-palves at redhat dot com> <56337B95 dot 6070809 at ericsson dot com>
On 10/30/2015 02:15 PM, Simon Marchi wrote:
> Could we also make c_string_type an enum flags type? Like so? There are
> some ugly casts remaining in the branch, like
>
> str_type = (enum c_string_type) (str_type & ~C_CHAR);
Good idea, indeed looks like we can.
> --- a/gdb/c-lang.h
> +++ b/gdb/c-lang.h
> @@ -34,7 +34,7 @@ struct parser_state;
> /* The various kinds of C string and character. Note that these
> values are chosen so that they may be or'd together in certain
> ways. */
> -enum c_string_type
> +enum c_string_type_values
> {
> /* An ordinary string: "value". */
> C_STRING = 0,
> @@ -56,6 +56,8 @@ enum c_string_type
> C_CHAR_32 = 7
> };
>
> +DEF_ENUM_FLAGS_TYPE (enum c_string_type_values, c_string_type);
Looks like c-lang.h should include common/enum_flags.h.
Otherwise LGTM.
I'd like to collect at least one Ack on the enum flags patch
before pushing it.
Thanks,
Pedro Alves