From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 49B13222EDCDE for ; Wed, 3 Jan 2018 00:32:43 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2018 00:37:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,500,1508828400"; d="scan'208";a="6977151" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 03 Jan 2018 00:37:45 -0800 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 3 Jan 2018 00:37:45 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 3 Jan 2018 00:37:45 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Wed, 3 Jan 2018 16:37:43 +0800 From: "Zhu, Yonghong" To: 'Laszlo Ersek' , 'edk2-devel-01' CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH] BaseTools/DevicePath: fix GCC build error in print_mem(), and clean it up Thread-Index: AQHTg+2g3Vw0VRNivUiKQd9kCFezCaNhW0/AgAB40CA= Date: Wed, 3 Jan 2018 08:37:42 +0000 Message-ID: References: <20180102171636.29351-1-lersek@redhat.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTk3MGUwYTctNzNlMy00MDUzLTkzNmQtNGIwYTU2MzNiNGUyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImZkRVhQV3lxRFNtbkhqSkZ6XC9ub0lLbURTbHZMckdDc2hcL3hnaXRZVmRUcz0ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools/DevicePath: fix GCC build error in print_mem(), and clean it up X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jan 2018 08:32:43 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I pushed this fix first since it blocked some GCC tool chain. SHA-1: 9a6b445bc2e6e2db6f67ab3cc425d5831aa1b7c8=20 Best Regards, Zhu Yonghong -----Original Message----- From: Zhu, Yonghong=20 Sent: Wednesday, January 3, 2018 9:27 AM To: Laszlo Ersek ; edk2-devel-01 Cc: Gao, Liming ; Zhu, Yonghong Subject: RE: [PATCH] BaseTools/DevicePath: fix GCC build error in print_mem= (), and clean it up Thanks. Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com] Sent: Wednesday, January 03, 2018 1:17 AM To: edk2-devel-01 Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH] BaseTools/DevicePath: fix GCC build error in print_mem(), = and clean it up Currently "BaseTools/Source/C/DevicePath/DevicePath.c" fails to build with GCC48: > DevicePath.c: In function 'print_mem': > DevicePath.c:109:5: error: 'for' loop initial declarations are only=20 > allowed in C99 mode > for (size_t i=3D0; i ^ > DevicePath.c:109:5: note: use option -std=3Dc99 or -std=3Dgnu99 to compil= e=20 > your code In addition, the print_mem() function does not conform to the edk2 coding style: - we use CamelCase and no underscores in identifiers, - the types and type qualifiers should follow the edk2 style, - initialization as part of definition is forbidden for local variables. Clean these up. While updating the print_mem()/PrintMem() call sites, also remove the super= fluous parentheses around the second argument. Cc: Liming Gao Cc: Yonghong Zhu Fixes: 7dbc50bd244d95fdc1741b9cfc561f0bfd724de1 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- Notes: Build-tested only (I don't have a DSC file with a device path PCD). BaseTools/Source/C/DevicePath/DevicePath.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/= C/DevicePath/DevicePath.c index 4c87163209ab..76b8553b7145 100644 --- a/BaseTools/Source/C/DevicePath/DevicePath.c +++ b/BaseTools/Source/C/DevicePath/DevicePath.c @@ -103,11 +103,19 @@ Returns: } =20 =20 -void print_mem(void const *vp, size_t n) +STATIC +VOID +PrintMem ( + CONST VOID *Buffer, + UINTN Count + ) { - unsigned char const *p =3D vp; - for (size_t i=3D0; iType =3D=3D END_DEVICE_PATH_TYPE) && (DevicePath->= SubType =3D=3D END_ENTIRE_DEVICE_PATH_SUBTYPE)) ) { - print_mem(DevicePath, (DevicePath->Length[0] | DevicePath->Length[1] <= < 8)); + PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1]=20 + << 8); DevicePath =3D (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)DevicePath + (Dev= icePath->Length[0] | DevicePath->Length[1] << 8)); } - print_mem(DevicePath, (DevicePath->Length[0] | DevicePath->Length[1] << = 8)); + PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1]=20 + << 8); putchar('\n'); return STATUS_SUCCESS; } -- 2.14.1.3.gb7cf6e02401b