GNU Binutils with patches for OS216
Revision | b50f188dfa065c9edfe82c874e2f8c179eb6d697 (tree) |
---|---|
Time | 2017-02-03 13:25:11 |
Author | Tom Tromey <tom@trom...> |
Commiter | Tom Tromey |
Reindent rust-lang.c
I noticed a few spots in rust-lang.c had incorrect indentation. This
patch fixes this.
2017-02-02 Tom Tromey <tom@tromey.com>
* rust-lang.c: Reindent.
@@ -1,5 +1,9 @@ | ||
1 | 1 | 2017-02-02 Tom Tromey <tom@tromey.com> |
2 | 2 | |
3 | + * rust-lang.c: Reindent. | |
4 | + | |
5 | +2017-02-02 Tom Tromey <tom@tromey.com> | |
6 | + | |
3 | 7 | * rust-lang.h (rust_crate_for_block): Update. |
4 | 8 | * rust-lang.c (rust_crate_for_block): Return std::string. |
5 | 9 | (rust_get_disr_info): Use std:;string, not |
@@ -100,7 +100,7 @@ rust_union_is_untagged (struct type *type) | ||
100 | 100 | if (TYPE_NFIELDS (type) == 0) |
101 | 101 | return false; |
102 | 102 | /* If the first field is named, but the name has the rust enum prefix, |
103 | - it is an enum. */ | |
103 | + it is an enum. */ | |
104 | 104 | if (strncmp (TYPE_FIELD_NAME (type, 0), RUST_ENUM_PREFIX, |
105 | 105 | strlen (RUST_ENUM_PREFIX)) == 0) |
106 | 106 | return false; |
@@ -514,8 +514,8 @@ val_print_struct (struct type *type, int embedded_offset, | ||
514 | 514 | |
515 | 515 | if (options->prettyformat) |
516 | 516 | { |
517 | - fputs_filtered ("\n", stream); | |
518 | - print_spaces_filtered (2 + 2 * recurse, stream); | |
517 | + fputs_filtered ("\n", stream); | |
518 | + print_spaces_filtered (2 + 2 * recurse, stream); | |
519 | 519 | } |
520 | 520 | else if (!first_field) |
521 | 521 | fputs_filtered (" ", stream); |
@@ -524,15 +524,15 @@ val_print_struct (struct type *type, int embedded_offset, | ||
524 | 524 | |
525 | 525 | if (!is_tuple && !is_tuple_struct) |
526 | 526 | { |
527 | - fputs_filtered (TYPE_FIELD_NAME (type, i), stream); | |
528 | - fputs_filtered (": ", stream); | |
527 | + fputs_filtered (TYPE_FIELD_NAME (type, i), stream); | |
528 | + fputs_filtered (": ", stream); | |
529 | 529 | } |
530 | 530 | |
531 | 531 | val_print (TYPE_FIELD_TYPE (type, i), |
532 | - embedded_offset + TYPE_FIELD_BITPOS (type, i) / 8, | |
533 | - address, | |
534 | - stream, recurse + 1, val, &opts, | |
535 | - current_language); | |
532 | + embedded_offset + TYPE_FIELD_BITPOS (type, i) / 8, | |
533 | + address, | |
534 | + stream, recurse + 1, val, &opts, | |
535 | + current_language); | |
536 | 536 | } |
537 | 537 | |
538 | 538 | if (options->prettyformat) |
@@ -659,17 +659,17 @@ rust_val_print (struct type *type, int embedded_offset, | ||
659 | 659 | struct disr_info disr; |
660 | 660 | struct value_print_options opts; |
661 | 661 | |
662 | - /* Untagged unions are printed as if they are structs. | |
663 | - Since the field bit positions overlap in the debuginfo, | |
664 | - the code for printing a union is same as that for a struct, | |
665 | - the only difference is that the input type will have overlapping | |
666 | - fields. */ | |
667 | - if (rust_union_is_untagged (type)) | |
668 | - { | |
669 | - val_print_struct (type, embedded_offset, address, stream, | |
670 | - recurse, val, options); | |
671 | - break; | |
672 | - } | |
662 | + /* Untagged unions are printed as if they are structs. | |
663 | + Since the field bit positions overlap in the debuginfo, | |
664 | + the code for printing a union is same as that for a struct, | |
665 | + the only difference is that the input type will have overlapping | |
666 | + fields. */ | |
667 | + if (rust_union_is_untagged (type)) | |
668 | + { | |
669 | + val_print_struct (type, embedded_offset, address, stream, | |
670 | + recurse, val, options); | |
671 | + break; | |
672 | + } | |
673 | 673 | |
674 | 674 | opts = *options; |
675 | 675 | opts.deref_ref = 0; |
@@ -760,62 +760,62 @@ rust_print_type (struct type *type, const char *varstring, | ||
760 | 760 | /* Print a struct or union typedef. */ |
761 | 761 | static void |
762 | 762 | rust_print_struct_def (struct type *type, const char *varstring, |
763 | - struct ui_file *stream, int show, int level, | |
764 | - const struct type_print_options *flags) | |
763 | + struct ui_file *stream, int show, int level, | |
764 | + const struct type_print_options *flags) | |
765 | 765 | { |
766 | - int is_tuple_struct, i; | |
766 | + int is_tuple_struct, i; | |
767 | 767 | |
768 | - /* Print a tuple type simply. */ | |
769 | - if (rust_tuple_type_p (type)) | |
770 | - { | |
771 | - fputs_filtered (TYPE_TAG_NAME (type), stream); | |
772 | - return; | |
773 | - } | |
768 | + /* Print a tuple type simply. */ | |
769 | + if (rust_tuple_type_p (type)) | |
770 | + { | |
771 | + fputs_filtered (TYPE_TAG_NAME (type), stream); | |
772 | + return; | |
773 | + } | |
774 | 774 | |
775 | - /* If we see a base class, delegate to C. */ | |
776 | - if (TYPE_N_BASECLASSES (type) > 0) | |
777 | - c_print_type (type, varstring, stream, show, level, flags); | |
775 | + /* If we see a base class, delegate to C. */ | |
776 | + if (TYPE_N_BASECLASSES (type) > 0) | |
777 | + c_print_type (type, varstring, stream, show, level, flags); | |
778 | 778 | |
779 | 779 | /* This code path is also used by unions. */ |
780 | 780 | if (TYPE_CODE (type) == TYPE_CODE_STRUCT) |
781 | - fputs_filtered ("struct ", stream); | |
781 | + fputs_filtered ("struct ", stream); | |
782 | 782 | else |
783 | - fputs_filtered ("union ", stream); | |
783 | + fputs_filtered ("union ", stream); | |
784 | 784 | |
785 | - if (TYPE_TAG_NAME (type) != NULL) | |
786 | - fputs_filtered (TYPE_TAG_NAME (type), stream); | |
785 | + if (TYPE_TAG_NAME (type) != NULL) | |
786 | + fputs_filtered (TYPE_TAG_NAME (type), stream); | |
787 | 787 | |
788 | - is_tuple_struct = rust_tuple_struct_type_p (type); | |
788 | + is_tuple_struct = rust_tuple_struct_type_p (type); | |
789 | 789 | |
790 | - if (TYPE_NFIELDS (type) == 0 && !rust_tuple_type_p (type)) | |
791 | - return; | |
792 | - fputs_filtered (is_tuple_struct ? " (\n" : " {\n", stream); | |
790 | + if (TYPE_NFIELDS (type) == 0 && !rust_tuple_type_p (type)) | |
791 | + return; | |
792 | + fputs_filtered (is_tuple_struct ? " (\n" : " {\n", stream); | |
793 | 793 | |
794 | - for (i = 0; i < TYPE_NFIELDS (type); ++i) | |
795 | - { | |
796 | - const char *name; | |
794 | + for (i = 0; i < TYPE_NFIELDS (type); ++i) | |
795 | + { | |
796 | + const char *name; | |
797 | 797 | |
798 | - QUIT; | |
799 | - if (field_is_static (&TYPE_FIELD (type, i))) | |
800 | - continue; | |
801 | - | |
802 | - /* We'd like to print "pub" here as needed, but rustc | |
803 | - doesn't emit the debuginfo, and our types don't have | |
804 | - cplus_struct_type attached. */ | |
805 | - | |
806 | - /* For a tuple struct we print the type but nothing | |
807 | - else. */ | |
808 | - print_spaces_filtered (level + 2, stream); | |
809 | - if (!is_tuple_struct) | |
810 | - fprintf_filtered (stream, "%s: ", TYPE_FIELD_NAME (type, i)); | |
811 | - | |
812 | - rust_print_type (TYPE_FIELD_TYPE (type, i), NULL, | |
813 | - stream, show - 1, level + 2, | |
814 | - flags); | |
815 | - fputs_filtered (",\n", stream); | |
816 | - } | |
798 | + QUIT; | |
799 | + if (field_is_static (&TYPE_FIELD (type, i))) | |
800 | + continue; | |
801 | + | |
802 | + /* We'd like to print "pub" here as needed, but rustc | |
803 | + doesn't emit the debuginfo, and our types don't have | |
804 | + cplus_struct_type attached. */ | |
805 | + | |
806 | + /* For a tuple struct we print the type but nothing | |
807 | + else. */ | |
808 | + print_spaces_filtered (level + 2, stream); | |
809 | + if (!is_tuple_struct) | |
810 | + fprintf_filtered (stream, "%s: ", TYPE_FIELD_NAME (type, i)); | |
811 | + | |
812 | + rust_print_type (TYPE_FIELD_TYPE (type, i), NULL, | |
813 | + stream, show - 1, level + 2, | |
814 | + flags); | |
815 | + fputs_filtered (",\n", stream); | |
816 | + } | |
817 | 817 | |
818 | - fprintfi_filtered (level, stream, is_tuple_struct ? ")" : "}"); | |
818 | + fprintfi_filtered (level, stream, is_tuple_struct ? ")" : "}"); | |
819 | 819 | } |
820 | 820 | |
821 | 821 | /* la_print_typedef implementation for Rust. */ |
@@ -906,7 +906,7 @@ rust_print_type (struct type *type, const char *varstring, | ||
906 | 906 | break; |
907 | 907 | |
908 | 908 | case TYPE_CODE_STRUCT: |
909 | - rust_print_struct_def (type, varstring, stream, show, level, flags); | |
909 | + rust_print_struct_def (type, varstring, stream, show, level, flags); | |
910 | 910 | break; |
911 | 911 | |
912 | 912 | case TYPE_CODE_ENUM: |
@@ -947,15 +947,15 @@ rust_print_type (struct type *type, const char *varstring, | ||
947 | 947 | /* Skip the discriminant field. */ |
948 | 948 | int skip_to = 1; |
949 | 949 | |
950 | - /* Unions and structs have the same syntax in Rust, | |
951 | - the only difference is that structs are declared with `struct` | |
952 | - and union with `union`. This difference is handled in the struct | |
953 | - printer. */ | |
954 | - if (rust_union_is_untagged (type)) | |
955 | - { | |
956 | - rust_print_struct_def (type, varstring, stream, show, level, flags); | |
957 | - break; | |
958 | - } | |
950 | + /* Unions and structs have the same syntax in Rust, | |
951 | + the only difference is that structs are declared with `struct` | |
952 | + and union with `union`. This difference is handled in the struct | |
953 | + printer. */ | |
954 | + if (rust_union_is_untagged (type)) | |
955 | + { | |
956 | + rust_print_struct_def (type, varstring, stream, show, level, flags); | |
957 | + break; | |
958 | + } | |
959 | 959 | |
960 | 960 | fputs_filtered ("enum ", stream); |
961 | 961 | if (TYPE_TAG_NAME (type) != NULL) |