From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.60.1608139360668163234 for ; Wed, 16 Dec 2020 09:22:40 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pierre.gondois@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 635F2D6E; Wed, 16 Dec 2020 09:22:40 -0800 (PST) Received: from e120189.arm.com (unknown [10.57.25.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3EC7C3F66E; Wed, 16 Dec 2020 09:22:39 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io, ard.biesheuvel@arm.com, leif@nuviainc.com Cc: sami.mujawar@arm.com Subject: [PATCH v1 13/25] ArmPkg: Fix Ecc error 5007 in CompilerIntrinsicsLib Date: Wed, 16 Dec 2020 17:21:48 +0000 Message-Id: <20201216172200.25846-14-Pierre.Gondois@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201216172200.25846-1-Pierre.Gondois@arm.com> References: <20201216172200.25846-1-Pierre.Gondois@arm.com> From: Pierre Gondois This patch fixes the following Ecc reported error: There should be no initialization of a variable as part of its declaration Signed-off-by: Pierre Gondois --- The changes can be seen at: https://github.com/PierreARM/edk2/commits/1552_Ecc_ArmPkg_v1 ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c | 7 +++++-- ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c | 7 +++++-- ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c | 7 +++++-- ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c | 7 +++++-- ArmPkg/Library/CompilerIntrinsicsLib/memset.c | 4 +++- ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c | 4 +++- 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c index 8491e2401f1e..5e46a7345d84 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcmp_ms.c @@ -18,8 +18,11 @@ int memcmp(void *, void *, size_t); #pragma function(memcmp) int memcmp(const void *s1, const void *s2, size_t n) { - unsigned char const *t1 = s1; - unsigned char const *t2 = s2; + unsigned char const *t1; + unsigned char const *t2; + + t1 = s1; + t2 = s2; while (n-- != 0) { if (*t1 != *t2) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c index d4827531dd04..6d40c423c608 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c @@ -11,8 +11,11 @@ typedef __SIZE_TYPE__ size_t; static void __memcpy(void *dest, const void *src, size_t n) { - unsigned char *d = dest; - unsigned char const *s = src; + unsigned char *d; + unsigned char const *s; + + d = dest; + s = src; while (n-- != 0) { *d++ = *s++; diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c index a9590df68054..616a08a05f4d 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy_ms.c @@ -18,8 +18,11 @@ void* memcpy(void *, const void *, size_t); #pragma function(memcpy) void* memcpy(void *dest, const void *src, size_t n) { - unsigned char *d = dest; - unsigned char const *s = src; + unsigned char *d; + unsigned char const *s; + + d = dest; + s = src; while (n-- != 0) { *d++ = *s++; diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c b/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c index a2e1ef9c8883..36b0a1101515 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memmove_ms.c @@ -18,8 +18,11 @@ void* memmove(void *, const void *, size_t); #pragma function(memmove) void* memmove(void *dest, const void *src, size_t n) { - unsigned char *d = dest; - unsigned char const *s = src; + unsigned char *d; + unsigned char const *s; + + d = dest; + s = src; if (d < s) { while (n-- != 0) { diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c index 57fc776333b0..1d53c2644566 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/memset.c +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset.c @@ -12,7 +12,9 @@ typedef __SIZE_TYPE__ size_t; static __attribute__((__used__)) void *__memset(void *s, int c, size_t n) { - unsigned char *d = s; + unsigned char *d; + + d = s; while (n-- != 0) { *d++ = c; diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c b/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c index 463fc21d3184..86dcf3b08c07 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c @@ -18,7 +18,9 @@ void* memset(void *, int, size_t); #pragma function(memset) void *memset(void *s, int c, size_t n) { - unsigned char *d = s; + unsigned char *d; + + d = s; while (n-- != 0) { *d++ = (unsigned char)c; -- 2.17.1