+#if defined(_MSC_EXTENSIONS)\r
+//\r
+// Disable warning when last field of data structure is a zero sized array.\r
+//\r
+#pragma warning ( disable : 4200 )\r
+#endif\r
+\r
+/**\r
+ Verifies the storage size of a given data type.\r
+\r
+ This macro generates a divide by zero error or a zero size array declaration in\r
+ the preprocessor if the size is incorrect. These are declared as "extern" so\r
+ the space for these arrays will not be in the modules.\r
+\r
+ @param TYPE The date type to determine the size of.\r
+ @param Size The expected size for the TYPE.\r
+\r
+**/\r
+#define VERIFY_SIZE_OF(TYPE, Size) extern UINT8 _VerifySizeof##TYPE[(sizeof(TYPE) == (Size)) / (sizeof(TYPE) == (Size))]\r
+\r
+//\r
+// Verify that ProcessorBind.h produced UEFI Data Types that are compliant with\r
+// Section 2.3.1 of the UEFI 2.3 Specification.\r
+//\r
+VERIFY_SIZE_OF (BOOLEAN, 1);\r
+VERIFY_SIZE_OF (INT8, 1);\r
+VERIFY_SIZE_OF (UINT8, 1);\r
+VERIFY_SIZE_OF (INT16, 2);\r
+VERIFY_SIZE_OF (UINT16, 2);\r
+VERIFY_SIZE_OF (INT32, 4);\r
+VERIFY_SIZE_OF (UINT32, 4);\r
+VERIFY_SIZE_OF (INT64, 8);\r
+VERIFY_SIZE_OF (UINT64, 8);\r
+VERIFY_SIZE_OF (CHAR8, 1);\r
+VERIFY_SIZE_OF (CHAR16, 2);\r
+\r
+//\r
+// The following three enum types are used to verify that the compiler\r
+// configuration for enum types is compliant with Section 2.3.1 of the \r
+// UEFI 2.3 Specification. These enum types and enum values are not \r
+// intended to be used. A prefix of '__' is used avoid conflicts with\r
+// other types.\r
+//\r
+typedef enum {\r
+ __VerifyUint8EnumValue = 0xff\r
+} __VERIFY_UINT8_ENUM_SIZE;\r
+\r
+typedef enum {\r
+ __VerifyUint16EnumValue = 0xffff\r
+} __VERIFY_UINT16_ENUM_SIZE;\r
+\r
+typedef enum {\r
+ __VerifyUint32EnumValue = 0xffffffff\r
+} __VERIFY_UINT32_ENUM_SIZE;\r
+\r
+VERIFY_SIZE_OF (__VERIFY_UINT8_ENUM_SIZE, 4);\r
+VERIFY_SIZE_OF (__VERIFY_UINT16_ENUM_SIZE, 4);\r
+VERIFY_SIZE_OF (__VERIFY_UINT32_ENUM_SIZE, 4);\r
+\r
+//\r
+// The Microsoft* C compiler can removed references to unreferenced data items\r
+// if the /OPT:REF linker option is used. We defined a macro as this is a\r
+// a non standard extension\r
+//\r
+#if defined(_MSC_EXTENSIONS) && _MSC_VER < 1800 && !defined (MDE_CPU_EBC)\r
+ ///\r
+ /// Remove global variable from the linked image if there are no references to\r
+ /// it after all compiler and linker optimizations have been performed.\r
+ ///\r
+ ///\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)\r
+#else\r
+ ///\r
+ /// Remove the global variable from the linked image if there are no references\r
+ /// to it after all compiler and linker optimizations have been performed.\r
+ ///\r
+ ///\r
+ #define GLOBAL_REMOVE_IF_UNREFERENCED\r
+#endif\r
+\r
+//\r
+// Should be used in combination with NORETURN to avoid 'noreturn' returns\r
+// warnings.\r
+//\r
+#ifndef UNREACHABLE\r
+ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)\r
+ ///\r
+ /// Signal compilers and analyzers that this call is not reachable. It is\r
+ /// up to the compiler to remove any code past that point.\r
+ /// Not implemented by GCC 4.4 or earlier.\r
+ ///\r
+ #define UNREACHABLE() __builtin_unreachable ()\r
+ #elif defined (__has_feature)\r
+ #if __has_builtin (__builtin_unreachable)\r
+ ///\r
+ /// Signal compilers and analyzers that this call is not reachable. It is\r
+ /// up to the compiler to remove any code past that point.\r
+ ///\r
+ #define UNREACHABLE() __builtin_unreachable ()\r
+ #endif\r
+ #endif\r
+\r
+ #ifndef UNREACHABLE\r
+ ///\r
+ /// Signal compilers and analyzers that this call is not reachable. It is\r
+ /// up to the compiler to remove any code past that point.\r
+ ///\r
+ #define UNREACHABLE()\r
+ #endif\r
+#endif\r
+\r
+//\r
+// Signaling compilers and analyzers that a certain function cannot return may\r
+// remove all following code and thus lead to better optimization and less\r
+// false positives.\r
+//\r
+#ifndef NORETURN\r
+ #if defined (__GNUC__) || defined (__clang__)\r
+ ///\r
+ /// Signal compilers and analyzers that the function cannot return.\r
+ /// It is up to the compiler to remove any code past a call to functions\r
+ /// flagged with this attribute.\r
+ ///\r
+ #define NORETURN __attribute__((noreturn))\r
+ #elif defined(_MSC_EXTENSIONS) && !defined(MDE_CPU_EBC)\r
+ ///\r
+ /// Signal compilers and analyzers that the function cannot return.\r
+ /// It is up to the compiler to remove any code past a call to functions\r
+ /// flagged with this attribute.\r
+ ///\r
+ #define NORETURN __declspec(noreturn)\r
+ #else\r
+ ///\r
+ /// Signal compilers and analyzers that the function cannot return.\r
+ /// It is up to the compiler to remove any code past a call to functions\r
+ /// flagged with this attribute.\r
+ ///\r
+ #define NORETURN\r
+ #endif\r
+#endif\r
+\r
+//\r
+// Should be used in combination with ANALYZER_NORETURN to avoid 'noreturn'\r
+// returns warnings.\r
+//\r
+#ifndef ANALYZER_UNREACHABLE\r
+ #ifdef __clang_analyzer__\r
+ #if __has_builtin (__builtin_unreachable)\r
+ ///\r
+ /// Signal the analyzer that this call is not reachable.\r
+ /// This excludes compilers.\r
+ ///\r
+ #define ANALYZER_UNREACHABLE() __builtin_unreachable ()\r
+ #endif\r
+ #endif\r
+\r
+ #ifndef ANALYZER_UNREACHABLE\r
+ ///\r
+ /// Signal the analyzer that this call is not reachable.\r
+ /// This excludes compilers.\r
+ ///\r
+ #define ANALYZER_UNREACHABLE()\r
+ #endif\r
+#endif\r
+\r
+//\r
+// Static Analyzers may issue errors about potential NULL-dereferences when\r
+// dereferencing a pointer, that has been checked before, outside of a\r
+// NULL-check. This may lead to false positives, such as when using ASSERT()\r
+// for verification.\r
+//\r
+#ifndef ANALYZER_NORETURN\r
+ #ifdef __has_feature\r
+ #if __has_feature (attribute_analyzer_noreturn)\r
+ ///\r
+ /// Signal analyzers that the function cannot return.\r
+ /// This excludes compilers.\r
+ ///\r
+ #define ANALYZER_NORETURN __attribute__((analyzer_noreturn))\r
+ #endif\r
+ #endif\r
+\r
+ #ifndef ANALYZER_NORETURN\r
+ ///\r
+ /// Signal the analyzer that the function cannot return.\r
+ /// This excludes compilers.\r
+ ///\r
+ #define ANALYZER_NORETURN\r
+ #endif\r
+#endif\r
+\r
+//\r
+// For symbol name in assembly code, an extra "_" is sometimes necessary\r
+//\r
+\r
+///\r
+/// Private worker functions for ASM_PFX()\r
+///\r
+#define _CONCATENATE(a, b) __CONCATENATE(a, b)\r
+#define __CONCATENATE(a, b) a ## b\r
+\r