From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 5/6] Indentation.
Date: Thu, 01 Nov 2012 07:47:00 -0000 [thread overview]
Message-ID: <1351756007-18242-6-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1351756007-18242-1-git-send-email-yao@codesourcery.com>
gdb:
2012-11-01 Yao Qi <yao@codesourcery.com>
* eval.c (evaluate_struct_tuple): Indent code.
---
gdb/eval.c | 88 ++++++++++++++++++++++++++++-------------------------------
1 files changed, 42 insertions(+), 46 deletions(-)
diff --git a/gdb/eval.c b/gdb/eval.c
index 62b26a9..f655957 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -295,53 +295,49 @@ evaluate_struct_tuple (struct value *struct_val,
struct value *val = NULL;
int bitpos, bitsize;
bfd_byte *addr;
- {
- {
- {
- fieldno++;
- /* Skip static fields. */
- while (fieldno < TYPE_NFIELDS (struct_type)
- && field_is_static (&TYPE_FIELD (struct_type,
- fieldno)))
- fieldno++;
- if (fieldno >= TYPE_NFIELDS (struct_type))
- error (_("too many initializers"));
- field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
- if (TYPE_CODE (field_type) == TYPE_CODE_UNION
- && TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0')
- error (_("don't know which variant you want to set"));
- }
- }
- /* Here, struct_type is the type of the inner struct,
- while substruct_type is the type of the inner struct.
- These are the same for normal structures, but a variant struct
- contains anonymous union fields that contain substruct fields.
- The value fieldno is the index of the top-level (normal or
- anonymous union) field in struct_field, while the value
- subfieldno is the index of the actual real (named inner) field
- in substruct_type. */
-
- field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
- if (val == 0)
- val = evaluate_subexp (field_type, exp, pos, noside);
-
- /* Now actually set the field in struct_val. */
-
- /* Assign val to field fieldno. */
- if (value_type (val) != field_type)
- val = value_cast (field_type, val);
-
- bitsize = TYPE_FIELD_BITSIZE (struct_type, fieldno);
- bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno);
- addr = value_contents_writeable (struct_val) + bitpos / 8;
- if (bitsize)
- modify_field (struct_type, addr,
- value_as_long (val), bitpos % 8, bitsize);
- else
- memcpy (addr, value_contents (val),
- TYPE_LENGTH (value_type (val)));
- }
+ fieldno++;
+ /* Skip static fields. */
+ while (fieldno < TYPE_NFIELDS (struct_type)
+ && field_is_static (&TYPE_FIELD (struct_type,
+ fieldno)))
+ fieldno++;
+ if (fieldno >= TYPE_NFIELDS (struct_type))
+ error (_("too many initializers"));
+ field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
+ if (TYPE_CODE (field_type) == TYPE_CODE_UNION
+ && TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0')
+ error (_("don't know which variant you want to set"));
+
+ /* Here, struct_type is the type of the inner struct,
+ while substruct_type is the type of the inner struct.
+ These are the same for normal structures, but a variant struct
+ contains anonymous union fields that contain substruct fields.
+ The value fieldno is the index of the top-level (normal or
+ anonymous union) field in struct_field, while the value
+ subfieldno is the index of the actual real (named inner) field
+ in substruct_type. */
+
+ field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
+ if (val == 0)
+ val = evaluate_subexp (field_type, exp, pos, noside);
+
+ /* Now actually set the field in struct_val. */
+
+ /* Assign val to field fieldno. */
+ if (value_type (val) != field_type)
+ val = value_cast (field_type, val);
+
+ bitsize = TYPE_FIELD_BITSIZE (struct_type, fieldno);
+ bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno);
+ addr = value_contents_writeable (struct_val) + bitpos / 8;
+ if (bitsize)
+ modify_field (struct_type, addr,
+ value_as_long (val), bitpos % 8, bitsize);
+ else
+ memcpy (addr, value_contents (val),
+ TYPE_LENGTH (value_type (val)));
+
}
return struct_val;
}
--
1.7.7.6
next prev parent reply other threads:[~2012-11-01 7:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-01 7:47 [PATCH 0/6] Remove unused operator OP_LABELED Yao Qi
2012-11-01 7:47 ` [PATCH 4/6] Remove 'substruct_type' and 'subfieldno' Yao Qi
2012-11-01 15:44 ` Tom Tromey
2012-11-01 7:47 ` [PATCH 6/6] Test nested struct assign Yao Qi
2012-11-01 15:47 ` Tom Tromey
2012-11-01 7:47 ` [PATCH 2/6] Update comment of evaluate_struct_tuple Yao Qi
2012-11-01 15:42 ` Tom Tromey
2012-11-01 7:47 ` [PATCH 1/6] Remove OP_LABELED Yao Qi
2012-11-01 15:41 ` Tom Tromey
2012-11-02 16:43 ` Pedro Alves
2012-11-02 16:49 ` Tom Tromey
2012-11-02 16:51 ` Pedro Alves
2012-11-02 17:09 ` Tom Tromey
2012-11-02 17:25 ` Pedro Alves
2012-11-01 7:47 ` [PATCH 3/6] Remove 'variantno' Yao Qi
2012-11-01 15:44 ` Tom Tromey
2012-11-01 7:47 ` Yao Qi [this message]
2012-11-01 15:45 ` [PATCH 5/6] Indentation Tom Tromey
2012-11-01 15:47 ` [PATCH 0/6] Remove unused operator OP_LABELED Tom Tromey
2012-11-02 0:20 ` [committed]: " Yao Qi
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=1351756007-18242-6-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/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