eprintf.c 988 B

1234567891011121314151617181920212223242526272829
  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. #include "int_lib.h"
  9. #include <stdio.h>
  10. // __eprintf() was used in an old version of <assert.h>.
  11. // It can eventually go away, but it is needed when linking
  12. // .o files built with the old <assert.h>.
  13. //
  14. // It should never be exported from a dylib, so it is marked
  15. // visibility hidden.
  16. #ifndef DONT_DEFINE_EPRINTF
  17. #ifndef _WIN32
  18. __attribute__((visibility("hidden")))
  19. #endif
  20. COMPILER_RT_ABI void
  21. __eprintf(const char *format, const char *assertion_expression,
  22. const char *line, const char *file) {
  23. fprintf(stderr, format, assertion_expression, line, file);
  24. fflush(stderr);
  25. compilerrt_abort();
  26. }
  27. #endif