From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2052 invoked by alias); 1 Nov 2012 07:47:28 -0000 Received: (qmail 1988 invoked by uid 22791); 1 Nov 2012 07:47:27 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_CP X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Nov 2012 07:47:22 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TTpUn-0003i8-Jp from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 01 Nov 2012 00:47:21 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 1 Nov 2012 00:47:21 -0700 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Thu, 1 Nov 2012 00:47:20 -0700 From: Yao Qi To: Subject: [PATCH 5/6] Indentation. Date: Thu, 01 Nov 2012 07:47:00 -0000 Message-ID: <1351756007-18242-6-git-send-email-yao@codesourcery.com> In-Reply-To: <1351756007-18242-1-git-send-email-yao@codesourcery.com> References: <1351756007-18242-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00009.txt.bz2 gdb: 2012-11-01 Yao Qi * 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