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