// warnings.\r
//\r
#ifndef UNREACHABLE\r
- #ifdef __GNUC__\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
\r
//\r
// UEFI specification claims 1 and 0. We are concerned about the\r
-// complier portability so we did it this way.\r
+// compiler portability so we did it this way.\r
//\r
\r
///\r
\r
#define VA_COPY(Dest, Start) __va_copy (Dest, Start)\r
\r
-#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)\r
+#elif defined(__GNUC__)\r
+\r
+#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)\r
+//\r
+// X64 only. Use MS ABI version of GCC built-in macros for variable argument lists.\r
+//\r
+///\r
+/// Both GCC and LLVM 3.8 for X64 support new variable argument intrinsics for Microsoft ABI\r
+///\r
+\r
+///\r
+/// Variable used to traverse the list of arguments. This type can vary by\r
+/// implementation and could be an array or structure.\r
+///\r
+typedef __builtin_ms_va_list VA_LIST;\r
+\r
+#define VA_START(Marker, Parameter) __builtin_ms_va_start (Marker, Parameter)\r
+\r
+#define VA_ARG(Marker, TYPE) ((sizeof (TYPE) < sizeof (UINTN)) ? (TYPE)(__builtin_va_arg (Marker, UINTN)) : (TYPE)(__builtin_va_arg (Marker, TYPE)))\r
+\r
+#define VA_END(Marker) __builtin_ms_va_end (Marker)\r
+\r
+#define VA_COPY(Dest, Start) __builtin_ms_va_copy (Dest, Start)\r
+\r
+#else\r
//\r
// Use GCC built-in macros for variable argument lists.\r
//\r
\r
#define VA_COPY(Dest, Start) __builtin_va_copy (Dest, Start)\r
\r
+#endif\r
+\r
#else\r
///\r
/// Variable used to traverse the list of arguments. This type can vary by\r
#if defined(_MSC_EXTENSIONS) && !defined (__INTEL_COMPILER) && !defined (MDE_CPU_EBC)\r
#pragma intrinsic(_ReturnAddress)\r
/**\r
- Get the return address of the calling funcation.\r
+ Get the return address of the calling function.\r
\r
Based on intrinsic function _ReturnAddress that provides the address of\r
the instruction in the calling function that will be executed after\r
\r
@param L Return Level.\r
\r
- @return The return address of the calling funcation or 0 if L != 0.\r
+ @return The return address of the calling function or 0 if L != 0.\r
\r
**/\r
#define RETURN_ADDRESS(L) ((L == 0) ? _ReturnAddress() : (VOID *) 0)\r
#elif defined(__GNUC__)\r
void * __builtin_return_address (unsigned int level);\r
/**\r
- Get the return address of the calling funcation.\r
+ Get the return address of the calling function.\r
\r
Based on built-in Function __builtin_return_address that returns\r
the return address of the current function, or of one of its callers.\r
\r
@param L Return Level.\r
\r
- @return The return address of the calling funcation.\r
+ @return The return address of the calling function.\r
\r
**/\r
#define RETURN_ADDRESS(L) __builtin_return_address (L)\r
#else\r
/**\r
- Get the return address of the calling funcation.\r
+ Get the return address of the calling function.\r
\r
@param L Return Level.\r
\r