+++ /dev/null
-/** @file\r
- Provides a definition of the assert macro used to insert diagnostic messages\r
- into code.\r
-\r
- This header file defines the assert macro and refers to the NDEBUG macro,\r
- which is NOT defined in this file.\r
-\r
- Unlike other header files, assert.h is designed to be included multiple\r
- times, with potentially different behavior on each inclusion.\r
-\r
- If the NDEBUG macro is defined at the point where assert.h\r
- is included, the assert macro is defined so as to not produce code.\r
- Otherwise, the assertion is tested and if the assertion is FALSE\r
- (e.g. evaluates to 0) a diagnostic message of the form<BR>\r
- "Assertion failed: (EXPR), file FILE, function FUNC, line LINE.\n"<BR>\r
- is produced.\r
- A FALSE evaluation will also result in the application being aborted.\r
-\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#include <sys/EfiCdefs.h>\r
-\r
-#undef assert ///< Remove any existing definition for assert.\r
-\r
-/** Internal helper function for the assert macro.\r
- The __assert function prints a diagnostic message then exits the\r
- currently running application.\r
-\r
- This function should NEVER be called directly.\r
-\r
- Some pre-processors do not provide the __func__ identifier. When that is\r
- the case, __func__ will be NULL. This function accounts for this and\r
- will modify the diagnostic message appropriately.\r
-\r
-\r
- @param[in] file The name of the file containing the assert.\r
- @param[in] func The name of the function containing the assert.\r
- @param[in] line The line number the assert is located on.\r
- @param[in] failedexpr A literal representation of the assert's expression.\r
-\r
- @return The __assert function will never return. It aborts the\r
- current application and returns to the environment that\r
- the application was launched from.\r
-**/\r
-extern void\r
-__assert(const char *file, const char *func, int line, const char *failedexpr);\r
-\r
-/** The assert macro puts diagnostic tests into programs; it expands to a\r
- void expression.\r
-\r
- When it is executed, if expression (which must have a scalar type) is\r
- FALSE (that is, compares equal to 0), the assert macro writes information\r
- about the particular call that failed (including the text of the argument,\r
- the name of the source file, the source line number, and the name of the\r
- enclosing function - the latter are respectively the values of the\r
- preprocessing macros __FILE__ and __LINE__ and of the identifier __func__)\r
- on the standard error stream. It then calls the abort function.\r
-\r
- If NDEBUG is not defined, Expression is evaluated. If Expression evaluates to FALSE,\r
- then __assert is called passing in the source filename, source function, source\r
- line number, and the Expression.\r
-\r
- @param Expression Boolean expression.\r
-\r
-@{\r
-**/\r
-#ifdef NDEBUG\r
-#define assert(Expression) /* ignored */\r
-\r
-#else\r
-#define assert(Expression) ((Expression) ? (void)0 :\\r
- __assert(__FILE__, __func__, __LINE__, #Expression) )\r
-#endif\r
-/// @}\r
-/* END of file assert.h */\r