From: "Vitaly Cheptsov" <vit9696@protonmail.com>
To: devel@edk2.groups.io
Subject: [PATCH 1/1] MdePkg: Use _MSC_VER to determine MSVC compiler
Date: Fri, 31 Jan 2020 21:17:14 +0000 [thread overview]
Message-ID: <20200131211705.18511-2-vit9696@protonmail.com> (raw)
In-Reply-To: <20200131211705.18511-1-vit9696@protonmail.com>
[-- Attachment #1: Type: text/plain, Size: 5798 bytes --]
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2397
CLANGPDB toolchain, implemented by clang compiler, will also
define currently used _MSC_EXTENSIONS macro, which does not
behave correctly in many situations as explained in the report.
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
MdePkg/Include/AArch64/ProcessorBind.h | 2 +-
MdePkg/Include/Arm/ProcessorBind.h | 8 ++++----
MdePkg/Include/Base.h | 10 +++++-----
MdePkg/Include/Ia32/ProcessorBind.h | 6 +++---
MdePkg/Include/X64/ProcessorBind.h | 6 +++---
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
index 896bf273ac..fe6b28ec9c 100644
--- a/MdePkg/Include/AArch64/ProcessorBind.h
+++ b/MdePkg/Include/AArch64/ProcessorBind.h
@@ -24,7 +24,7 @@
#pragma pack()
#endif
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// Disable some level 4 compilation warnings (same as IA32 and X64)
diff --git a/MdePkg/Include/Arm/ProcessorBind.h b/MdePkg/Include/Arm/ProcessorBind.h
index 1264b44b46..f5a5969d4a 100644
--- a/MdePkg/Include/Arm/ProcessorBind.h
+++ b/MdePkg/Include/Arm/ProcessorBind.h
@@ -22,7 +22,7 @@
#pragma pack()
#endif
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// Disable some level 4 compilation warnings (same as IA32 and X64)
@@ -74,11 +74,11 @@
//
// RVCT and MSFT don't support the __builtin_unreachable() macro
//
-#if defined(__ARMCC_VERSION) || defined(_MSC_EXTENSIONS)
+#if defined(__ARMCC_VERSION) || defined(_MSC_VER)
#define UNREACHABLE()
#endif
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// use Microsoft* C compiler dependent integer width types
//
@@ -212,7 +212,7 @@ typedef INT32 INTN;
#define GCC_ASM_IMPORT(name)
#endif
-#elif defined(_MSC_EXTENSIONS)
+#elif defined(_MSC_VER)
//
// PRESERVE8 is not supported by the MSFT assembler.
//
diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 321d729c04..bda630a2dc 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -21,7 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
#include <ProcessorBind.h>
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// Disable warning when last field of data structure is a zero sized array.
//
@@ -33,7 +33,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
-#if defined(_MSC_EXTENSIONS) && _MSC_VER < 1800 && !defined (MDE_CPU_EBC)
+#if defined(_MSC_VER) && _MSC_VER < 1800 && !defined (MDE_CPU_EBC)
///
/// Remove global variable from the linked image if there are no references to
/// it after all compiler and linker optimizations have been performed.
@@ -92,7 +92,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// flagged with this attribute.
///
#define NORETURN __attribute__((noreturn))
- #elif defined(_MSC_EXTENSIONS) && !defined(MDE_CPU_EBC)
+ #elif defined(_MSC_VER) && !defined(MDE_CPU_EBC)
///
/// Signal compilers and analyzers that the function cannot return.
/// It is up to the compiler to remove any code past a call to functions
@@ -799,7 +799,7 @@ typedef UINTN *BASE_LIST;
**/
#ifdef MDE_CPU_EBC
#define STATIC_ASSERT(Expression, Message)
-#elif defined(_MSC_EXTENSIONS)
+#elif defined(_MSC_VER)
#define STATIC_ASSERT static_assert
#else
#define STATIC_ASSERT _Static_assert
@@ -1256,7 +1256,7 @@ typedef UINTN RETURN_STATUS;
#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
(SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
-#if defined(_MSC_EXTENSIONS) && !defined (__INTEL_COMPILER) && !defined (MDE_CPU_EBC)
+#if defined(_MSC_VER) && !defined (__INTEL_COMPILER) && !defined (MDE_CPU_EBC)
void * _ReturnAddress(void);
#pragma intrinsic(_ReturnAddress)
/**
diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h
index fa4b7e8e98..bf6a8b09f5 100644
--- a/MdePkg/Include/Ia32/ProcessorBind.h
+++ b/MdePkg/Include/Ia32/ProcessorBind.h
@@ -49,7 +49,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#endif
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// Disable warning that make it impossible to compile at /W4
@@ -110,7 +110,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#endif
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// use Microsoft C compiler dependent integer width types
@@ -276,7 +276,7 @@ typedef INT32 INTN;
///
/// If EFIAPI is already defined, then we use that definition.
///
-#elif defined(_MSC_EXTENSIONS)
+#elif defined(_MSC_VER)
///
/// Microsoft* compiler specific method for EFIAPI calling convention.
///
diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
index 387e9c5c9c..2e8ac6c8d5 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -63,7 +63,7 @@
#endif
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// Disable warning that make it impossible to compile at /W4
@@ -124,7 +124,7 @@
#endif
-#if defined(_MSC_EXTENSIONS)
+#if defined(_MSC_VER)
//
// use Microsoft C compiler dependent integer width types
//
@@ -290,7 +290,7 @@ typedef INT64 INTN;
///
/// If EFIAPI is already defined, then we use that definition.
///
-#elif defined(_MSC_EXTENSIONS)
+#elif defined(_MSC_VER)
///
/// Microsoft* compiler specific method for EFIAPI calling convention.
///
--
2.21.1 (Apple Git-122.3)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 489 bytes --]
next prev parent reply other threads:[~2020-01-31 21:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 21:17 [PATCH 0/1] Use _MSC_VER to determine MSVC compiler Vitaly Cheptsov
2020-01-31 21:17 ` Vitaly Cheptsov [this message]
2020-02-03 8:00 ` [edk2-devel] " Liming Gao
2020-02-03 11:28 ` Vitaly Cheptsov
2020-02-04 6:56 ` Liming Gao
2020-02-06 0:17 ` Vitaly Cheptsov
2020-02-06 8:22 ` Liming Gao
2020-02-06 11:44 ` Vitaly Cheptsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200131211705.18511-2-vit9696@protonmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox