This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix handling of discriminantless univariant enums in Rust

>>>>> "Manish" == Manish Goregaokar <> 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> + = 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> +  }
Manish>    if (strcmp (TYPE_FIELD_NAME (disr_type, 0), "RUST$ENUM$DISR") != 0)

This still should follow GNU style.
And I think a blank line after the "}".

Manish> +gdb_test "print" " =
Manish> \\(simple::ParametrizedStruct<i32> \\*\\) $hex"

Patch mangled by mail program.
No biggie but it's a pain if one wants to try it out.

Manish> $hex\\}, value: 0\\}"
Manish> \ No newline at end of file

Please add a newline.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]