blob: 89f34b154577fd0d655a607631110cd7a196ccd9 [file] [log] [blame]
Edward O'Callaghan4856eef2009-08-05 04:02:56 +00001/* ===---------- eprintf.c - Implements __eprintf --------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
Howard Hinnant5b791f62010-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'Callaghan4856eef2009-08-05 04:02:56 +00007 *
8 * ===----------------------------------------------------------------------===
9 */
Daniel Dunbarfd089992009-06-26 16:47:03 +000010
11
12
Daniel Dunbarf2870082010-03-31 17:00:45 +000013#include "int_lib.h"
Daniel Dunbarfd089992009-06-26 16:47:03 +000014#include <stdio.h>
Daniel Dunbarfd089992009-06-26 16:47:03 +000015
16
Edward O'Callaghan4856eef2009-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 Korobeynikovec42bd92013-07-16 22:37:55 +000025#ifndef _WIN32
Daniel Dunbarfd089992009-06-26 16:47:03 +000026__attribute__((visibility("hidden")))
Anton Korobeynikovec42bd92013-07-16 22:37:55 +000027#endif
Joerg Sonnenberger6e99daa2014-03-01 15:30:50 +000028COMPILER_RT_ABI void
29__eprintf(const char* format, const char* assertion_expression,
30 const char* line, const char* file)
Daniel Dunbarfd089992009-06-26 16:47:03 +000031{
32 fprintf(stderr, format, assertion_expression, line, file);
33 fflush(stderr);
Daniel Dunbarf2870082010-03-31 17:00:45 +000034 compilerrt_abort();
Daniel Dunbarfd089992009-06-26 16:47:03 +000035}