sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * FUNCTION sl@0: * <>---Macro for Debugging Diagnostics sl@0: * INDEX sl@0: * assert sl@0: * ANSI_SYNOPSIS sl@0: * #include sl@0: * void assert(int <[expression]>); sl@0: * TRAD_SYNOPSIS sl@0: * #include sl@0: * assert(<[expression]>) sl@0: * int <[expression]>; sl@0: * Use this macro to embed debuggging diagnostic statements in sl@0: * your programs. The argument <[expression]> should be an sl@0: * expression which evaluates to true (nonzero) when your program sl@0: * is working as you intended. sl@0: * When <[expression]> evaluates to false (zero), <> sl@0: * calls <>, after first printing a message showing what sl@0: * failed and where: sl@0: * . Assertion failed: <[expression]>, file <[filename]>, line <[lineno]> sl@0: * The macro is defined to permit you to turn off all uses of sl@0: * <> at compile time by defining <> as a sl@0: * preprocessor variable. If you do this, the <> macro sl@0: * expands to sl@0: * . (void(0)) sl@0: * RETURNS sl@0: * <> does not return a value. sl@0: * PORTABILITY sl@0: * The <> macro is required by ANSI, as is the behavior sl@0: * when <> is defined. sl@0: * Supporting OS subroutines required (only if enabled): <>, <>, sl@0: * <>, <>, <>, <>, <>, <>, <>. sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: EXPORT_C void __assert (const char *file, int line, const char *failedexpr) sl@0: { sl@0: (void)fprintf(stderr, sl@0: "assertion \"%s\" failed: file \"%s\", line %d\n", sl@0: failedexpr, file, line); sl@0: abort(); sl@0: /* NOTREACHED */ sl@0: }