This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix handling of discriminantless univariant enums in Rust
- From: Tom Tromey <tom at tromey dot com>
- To: Manish Goregaokar <manish at mozilla dot com>
- Cc: gdb-patches at sourceware dot org, Tom Tromey <tom at tromey dot com>
- Date: Sat, 29 Oct 2016 20:47:20 -0600
- Subject: Re: [PATCH] Fix handling of discriminantless univariant enums in Rust
- Authentication-results: sourceware.org; auth=none
- References: <CAFOnWkkxJqoZSP6ZKdC56fqG5iqhkAer-rwLOGcN0sanwXb4cA@mail.gmail.com>
>>>>> "Manish" == Manish Goregaokar <manish@mozilla.com> writes:
Manish> + else if (TYPE_NFIELDS (type) == 1) {
Manish> + /* Sometimes univariant enums are encoded without a
Manish> + discriminant. In that case, treating it as an encoded enum
Manish> + with the first field being the actual type works. */
Manish> + const char* field_name = TYPE_NAME (TYPE_FIELD_TYPE (type, 0));
Manish> + ret.name = concat (TYPE_NAME (type), "::",
Manish> + rust_last_path_segment (field_name),
Manish> + (char *) NULL);
Manish> + ret.field_no = RUST_ENCODED_ENUM_REAL;
Manish> + ret.is_encoded = 1;
Manish> + return ret;
Manish> + }
This needs some small changes to conform to the GNU coding style.
Also, I suspect this will wind up doing the wrong thing in the
STRUCTOP_ANONYMOUS case in rust_evaluate_subexp. In particular I wonder
if an additional "print univariant.0.a" test will work correctly?
Tom