xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/eprintf.c (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
10b57cec5SDimitry Andric //===---------- eprintf.c - Implements __eprintf --------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #include "int_lib.h"
100b57cec5SDimitry Andric #include <stdio.h>
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric // __eprintf() was used in an old version of <assert.h>.
130b57cec5SDimitry Andric // It can eventually go away, but it is needed when linking
140b57cec5SDimitry Andric // .o files built with the old <assert.h>.
150b57cec5SDimitry Andric //
160b57cec5SDimitry Andric // It should never be exported from a dylib, so it is marked
170b57cec5SDimitry Andric // visibility hidden.
18*bdd1243dSDimitry Andric #ifndef DONT_DEFINE_EPRINTF
190b57cec5SDimitry Andric #ifndef _WIN32
200b57cec5SDimitry Andric __attribute__((visibility("hidden")))
210b57cec5SDimitry Andric #endif
220b57cec5SDimitry Andric COMPILER_RT_ABI void
__eprintf(const char * format,const char * assertion_expression,const char * line,const char * file)230b57cec5SDimitry Andric __eprintf(const char *format, const char *assertion_expression,
240b57cec5SDimitry Andric           const char *line, const char *file) {
250b57cec5SDimitry Andric   fprintf(stderr, format, assertion_expression, line, file);
260b57cec5SDimitry Andric   fflush(stderr);
270b57cec5SDimitry Andric   compilerrt_abort();
280b57cec5SDimitry Andric }
29*bdd1243dSDimitry Andric #endif
30