From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Type-safe wrapper for enum flags
Date: Fri, 30 Oct 2015 17:39:00 -0000 [thread overview]
Message-ID: <56338435.6080703@redhat.com> (raw)
In-Reply-To: <56337B95.6070809@ericsson.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
next prev parent reply other threads:[~2015-10-30 14:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-30 8:12 Pedro Alves
2015-10-30 9:48 ` Pedro Alves
2015-10-30 17:08 ` Simon Marchi
2015-10-30 17:39 ` Pedro Alves [this message]
2015-10-31 20:11 ` Simon Marchi
2015-10-31 20:28 ` Pedro Alves
2015-11-01 2:07 ` Doug Evans
2015-11-03 11:48 ` Pedro Alves
2015-11-01 4:04 ` Doug Evans
2015-11-03 12:23 ` Pedro Alves
2015-11-01 15:19 ` Patrick Palka
2015-11-03 11:18 ` Pedro Alves
2015-11-09 13:25 ` Patrick Palka
2015-11-17 13:49 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56338435.6080703@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox