From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.6515.1589378395554182801 for ; Wed, 13 May 2020 06:59:55 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: jian.j.wang@intel.com) IronPort-SDR: q0rQ4JB3lIGGuFtrwg1jb0gWWNJlO1qxltiH2dMs18VJofD+M7vGyySYmTnq4bP6wPTtVo8iXt C6mnC2fMxUAA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 06:59:54 -0700 IronPort-SDR: vXv9dF9seN0Q8Dc90GRpvznjneLyjZve5xgRZGmw/QVLJWXnM3im/PZeKjvbvHuI6xWHrXyxXU 4nsCB3IuKkOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,388,1583222400"; d="scan'208";a="287038711" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 13 May 2020 06:59:54 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 May 2020 06:59:54 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 13 May 2020 06:59:53 -0700 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.110]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.50]) with mapi id 14.03.0439.000; Wed, 13 May 2020 21:59:50 +0800 From: "Wang, Jian J" To: "Zhang, Shenglei" , "devel@edk2.groups.io" CC: "Wu, Hao A" Subject: Re: [PATCH v2] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure Thread-Topic: [PATCH v2] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure Thread-Index: AQHWJziT7YO/2DJbDE+e9IRWaAeTcqimDUPQ Date: Wed, 13 May 2020 13:59:49 +0000 Message-ID: References: <20200511020448.15952-1-shenglei.zhang@intel.com> In-Reply-To: <20200511020448.15952-1-shenglei.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jian.j.wang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Shenglei, > -----Original Message----- > From: Zhang, Shenglei > Sent: Monday, May 11, 2020 10:05 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A > Subject: [PATCH v2] MdeModulePkg/RegularExpressionDxe: Optimize the code > infrastructure >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2712 > OnigurumaIntrinsics.c is now not used improperly. So the implements > of function 'memcpy' and 'memset' are not linked for all tool chains, > which causes build failure with CLANG9 and XCODE. I remove > OnigurumaIntrinsics.c and move the necessary function > implements to OnigurumaUefiPort.c/h. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Shenglei Zhang > --- > .../OnigurumaIntrinsics.c | 48 ------------------- > .../RegularExpressionDxe/OnigurumaUefiPort.c | 10 ++++ > .../RegularExpressionDxe/OnigurumaUefiPort.h | 2 + > .../RegularExpressionDxe.inf | 1 - > 4 files changed, 12 insertions(+), 49 deletions(-) > delete mode 100644 > MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c >=20 > diff --git > a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c > b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c > deleted file mode 100644 > index 536c7e0f1b26..000000000000 > --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c > +++ /dev/null > @@ -1,48 +0,0 @@ > -/** @file > - > - Provide intrinsics within Oniguruma > - > - (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> - Copyright (c) 2020, Intel Corporation. All rights reserved.
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > -**/ > - > -#include > - > -// > -// From CryptoPkg/IntrinsicLib > -// > - > -/* Copies bytes between buffers */ > -#pragma function(memcpy) > -void * memcpy (void *dest, const void *src, unsigned int count) > -{ > - return CopyMem (dest, src, (UINTN)count); > -} > - > -/* Sets buffers to a specified character */ > -#pragma function(memset) > -void * memset (void *dest, char ch, unsigned int count) > -{ > - // > - // NOTE: Here we use one base implementation for memset, instead of th= e > direct > - // optimized SetMem() wrapper. Because the IntrinsicLib has to b= e built > - // without whole program optimization option, and there will be = some > - // potential register usage errors when calling other optimized = codes. > - // > - > - // > - // Declare the local variables that actually move the data elements as > - // volatile to prevent the optimizer from replacing this function with > - // the intrinsic memset() > - // > - volatile UINT8 *Pointer; > - > - Pointer =3D (UINT8 *)dest; > - while (count-- !=3D 0) { > - *(Pointer++) =3D ch; > - } > - > - return dest; > -} > diff --git > a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c > b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c > index b1604b378af3..743f16612cc6 100644 > --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c > +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c > @@ -86,3 +86,13 @@ void * realloc (void *ptr, size_t size) > return NULL; > } >=20 > +void * memcpy (void *dest, const void *src, unsigned int count) > +{ > + return CopyMem (dest, src, (UINTN)count); > +} > + > +void * memset (void *dest, char ch, unsigned int count) > +{ > + return SetMem(dest, ch, count); There's no space before '('. > +} > + > diff --git > a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h > b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h > index 1a0b2daf473d..de98934c83dc 100644 > --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h > +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h > @@ -96,6 +96,8 @@ int EFIAPI sprintf_s (char *str, size_t sizeOfBuffer, c= har > const *fmt, ...); > int strlen(const char* str); > void* malloc(size_t size); > void* realloc(void *ptr, size_t size); > +void * memcpy (void *dest, const void *src, unsigned int count); > +void * memset (void *dest, char ch, unsigned int count); >=20 There's space before '*', which is not consistent with prototype lines abov= e. The same issue in OnigurumaUefiPort.c. In addition, please update or add year in copyright line. With them addressed, Reviewed-by: Jian J Wang Regards, Jian > #define exit(n) ASSERT(FALSE); >=20 > diff --git > a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf > b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf > index da63aa6eb418..84489c294279 100644 > --- > a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf > +++ > b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf > @@ -20,7 +20,6 @@ [Sources] > RegularExpressionDxe.h > OnigurumaUefiPort.h > OnigurumaUefiPort.c > - OnigurumaIntrinsics.c | MSFT >=20 > # Wrapper header files start # > stdio.h > -- > 2.18.0.windows.1