]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/assert.h
Print PCI Interrupt Line/Interrupt Pin registers before booting legacy OS.
[mirror_edk2.git] / StdLib / Include / assert.h
CommitLineData
2aa62f2b 1/** @file\r
2 Provides a definition of the assert macro.\r
3\r
4 This header file defines the assert macro and refers to the NDEBUG macro,\r
5 which is NOT defined in this file.\r
6\r
7 Unlike other header files, assert.h is designed to be included multiple\r
8 times, with potentially different behavior on each inclusion.\r
9\r
10 If the NDEBUG macro is defined at the point where assert.h\r
11 is included, the assert macro is defined so as to not produce code.\r
12 Otherwise, the assertion is tested and if the assertion is true a\r
13 diagnostic message of the form\r
14 "ASSERT <FileName>(<LineNumber>): <Description>\n" is produced.\r
15 A true assertion will also result in the application being terminated.\r
16\r
17 The behavior of the assert macro can be further modified by setting attributes\r
18 in the PcdDebugPropertyMask PCD entry when building the Application Toolkit.\r
19 If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of PcdDebugProperyMask is set\r
20 then CpuBreakpoint() is called. Otherwise, if the\r
21 DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then\r
22 CpuDeadLoop() is called. If neither of these bits are set, then the\r
23 application will be terminated immediately after the message is printed to\r
24 the debug output device.\r
25\r
26Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
27This program and the accompanying materials are licensed and made available under\r
28the terms and conditions of the BSD License that accompanies this distribution.\r
29The full text of the license may be found at\r
30http://opensource.org/licenses/bsd-license.php.\r
31\r
32THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
33WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
34\r
35**/\r
36#include <sys/EfiCdefs.h>\r
37\r
38#undef assert ///< Remove any existing definition for assert.\r
39\r
40extern void\r
41__assert(const char *func, const char *file, int line, const char *failedexpr);\r
42\r
43/** The assert macro puts diagnostic tests into programs; it expands to a\r
44 void expression.\r
45\r
46 When it is executed, if expression (which shall have a scalar type) is\r
47 false (that is, compares equal to 0), the assert macro writes information\r
48 about the particular call that failed (including the text of the argument,\r
49 the name of the source file, the source line number, and the name of the\r
50 enclosing function - the latter are respectively the values of the\r
51 preprocessing macros __FILE__ and __LINE__ and of the identifier __func__)\r
52 on the standard error stream. It then calls the abort function.\r
53\r
54 If NDEBUG is not defined, Expression is evaluated. If Expression evaluates to FALSE, then\r
55 __assert is called passing in the source filename, source function, source line number,\r
56 and the Expression.\r
57\r
58 @param Expression Boolean expression.\r
59\r
60@{\r
61**/\r
62#ifdef NDEBUG\r
63#define assert(Expression) /* ignored */\r
64\r
65#else\r
66#define assert(Expression) ((Expression) ? (void)0 :\\r
67 __assert(__func__, __FILE__, __LINE__, #Expression) )\r
68#endif\r
69/// @}\r
70/* END of file assert.h */\r