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 <vit9...@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)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#53624): https://edk2.groups.io/g/devel/message/53624
Mute This Topic: https://groups.io/mt/70882955/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to