Shenglei,
> -----Original Message----- > From: Zhang, Shenglei <[email protected]> > Sent: Monday, May 11, 2020 10:05 AM > To: [email protected] > Cc: Wang, Jian J <[email protected]>; Wu, Hao A <[email protected]> > Subject: [PATCH v2] MdeModulePkg/RegularExpressionDxe: Optimize the code > infrastructure > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2712 > 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. > > Cc: Jian J Wang <[email protected]> > Cc: Hao A Wu <[email protected]> > Signed-off-by: Shenglei Zhang <[email protected]> > --- > .../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 > > 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<BR> > - Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> > - > - SPDX-License-Identifier: BSD-2-Clause-Patent > -**/ > - > -#include <Library/BaseMemoryLib.h> > - > -// > -// 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 the > direct > - // optimized SetMem() wrapper. Because the IntrinsicLib has to be > 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 = (UINT8 *)dest; > - while (count-- != 0) { > - *(Pointer++) = 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; > } > > +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, char > 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); > There's space before '*', which is not consistent with prototype lines above. The same issue in OnigurumaUefiPort.c. In addition, please update or add year in copyright line. With them addressed, Reviewed-by: Jian J Wang <[email protected]> Regards, Jian > #define exit(n) ASSERT(FALSE); > > 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 > > # Wrapper header files start # > stdio.h > -- > 2.18.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59434): https://edk2.groups.io/g/devel/message/59434 Mute This Topic: https://groups.io/mt/74128047/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
