blob: 3626dbf8b0c4a45c1414194606ce663947ddbf0f [file] [log] [blame]
Edward O'Callaghan2bf62722009-08-05 04:02:56 +00001/* ===---------- eprintf.c - Implements __eprintf --------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
Howard Hinnant9ad441f2010-11-16 22:13:33 +00005 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
Edward O'Callaghan2bf62722009-08-05 04:02:56 +00007 *
8 * ===----------------------------------------------------------------------===
9 */
Daniel Dunbarb3a69012009-06-26 16:47:03 +000010
11
12
Daniel Dunbar48f46ac2010-03-31 17:00:45 +000013#include "int_lib.h"
Daniel Dunbarb3a69012009-06-26 16:47:03 +000014#include <stdio.h>
Daniel Dunbarb3a69012009-06-26 16:47:03 +000015
16
Edward O'Callaghan2bf62722009-08-05 04:02:56 +000017/*
18 * __eprintf() was used in an old version of <assert.h>.
19 * It can eventually go away, but it is needed when linking
20 * .o files built with the old <assert.h>.
21 *
22 * It should never be exported from a dylib, so it is marked
23 * visibility hidden.
24 */
Anton Korobeynikov6092c212013-07-16 22:37:55 +000025#ifndef _WIN32
Daniel Dunbarb3a69012009-06-26 16:47:03 +000026__attribute__((visibility("hidden")))
Anton Korobeynikov6092c212013-07-16 22:37:55 +000027#endif
Daniel Dunbarb3a69012009-06-26 16:47:03 +000028void __eprintf(const char* format, const char* assertion_expression,
29 const char* line, const char* file)
30{
31 fprintf(stderr, format, assertion_expression, line, file);
32 fflush(stderr);
Daniel Dunbar48f46ac2010-03-31 17:00:45 +000033 compilerrt_abort();
Daniel Dunbarb3a69012009-06-26 16:47:03 +000034}