]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Main/assert.c
2 The implementation of the __assert function used internally by the assert macro
3 to insert diagnostic messages into code.
5 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #include <LibConfig.h>
15 #include <sys/EfiCdefs.h>
20 /** Internal helper function for the assert macro.
21 The __assert function prints a diagnostic message then exits the
22 currently running application.
24 This function should NEVER be called directly.
26 Some pre-processors do not provide the __func__ identifier. When that is
27 the case, __func__ will be NULL. This function accounts for this and
28 will modify the diagnostic message appropriately.
31 @param[in] file The name of the file containing the assert.
32 @param[in] func The name of the function containing the assert
34 @param[in] line The line number the assert is located on.
35 @param[in] failedexpr A literal representation of the assert's expression.
37 @return The __assert function will never return. It terminates execution
38 of the current application and returns to the environment that
39 the application was launched from.
46 IN
const char *failedexpr
50 printf("Assertion failed: (%s), file %s, line %d.\n",
51 failedexpr
, file
, line
);
53 printf("Assertion failed: (%s), file %s, function %s, line %d.\n",
54 failedexpr
, file
, func
, line
);