From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.5624.1589006076776176534 for ; Fri, 08 May 2020 23:34:36 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: shenglei.zhang@intel.com) IronPort-SDR: IwfA7jz5PrcLAAkVftojIzAOqS+BPShm1Ij3iJsYJu1W2umxcqvuCl0m/5/DlFBvpn/Ug76ga9 ScgicMbg4uoQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 23:34:36 -0700 IronPort-SDR: 7z78vmU+h3T7z7NTB4yF8JYycUUthnfmjNNqgLhW7ElwksHh7Zsb4z5pwtDTea0hticYbnKa3c vsuF5ugK6uIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,370,1583222400"; d="scan'208";a="250665011" Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by fmsmga007.fm.intel.com with ESMTP; 08 May 2020 23:34:35 -0700 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu Subject: [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure Date: Sat, 9 May 2020 14:34:25 +0800 Message-Id: <20200509063425.13684-1-shenglei.zhang@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 OnigurumaIntrinsics.c is now not used. So the implement of function 'memcpy' is now not., which causes build failure with CLANG9 and XCODE. I remove OnigurumaIntrinsics.c and move the necessary function implement to OnigurumaUefiPort.c/h. Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Shenglei Zhang --- .../OnigurumaIntrinsics.c | 48 ------------------- .../RegularExpressionDxe/OnigurumaUefiPort.c | 5 ++ .../RegularExpressionDxe/OnigurumaUefiPort.h | 1 + .../RegularExpressionDxe.inf | 1 - 4 files changed, 6 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
- 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 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..a893ac86959f 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c @@ -86,3 +86,8 @@ 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); +} + diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h index 1a0b2daf473d..dfe4498ce57f 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h +++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h @@ -96,6 +96,7 @@ 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); #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