| 1 | //===---------- eprintf.c - Implements __eprintf --------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "int_lib.h" |
| 10 | #include <stdio.h> |
| 11 | |
| 12 | // __eprintf() was used in an old version of <assert.h>. |
| 13 | // It can eventually go away, but it is needed when linking |
| 14 | // .o files built with the old <assert.h>. |
| 15 | // |
| 16 | // It should never be exported from a dylib, so it is marked |
| 17 | // visibility hidden. |
| 18 | #ifndef DONT_DEFINE_EPRINTF |
| 19 | #ifndef _WIN32 |
| 20 | __attribute__((visibility("hidden" ))) |
| 21 | #endif |
| 22 | COMPILER_RT_ABI void |
| 23 | __eprintf(const char *format, const char *assertion_expression, |
| 24 | const char *line, const char *file) { |
| 25 | fprintf(stderr, format: format, assertion_expression, line, file); |
| 26 | fflush(stderr); |
| 27 | compilerrt_abort(); |
| 28 | } |
| 29 | #endif |
| 30 | |