error.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* Declaration for error-reporting function
  2. Copyright (C) 1995-2021 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _ERROR_H
  16. #define _ERROR_H 1
  17. #include <features.h>
  18. __BEGIN_DECLS
  19. /* Print a message with `fprintf (stderr, FORMAT, ...)';
  20. if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
  21. If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
  22. extern void error (int __status, int __errnum, const char *__format, ...)
  23. __attribute__ ((__format__ (__printf__, 3, 4)));
  24. extern void error_at_line (int __status, int __errnum, const char *__fname,
  25. unsigned int __lineno, const char *__format, ...)
  26. __attribute__ ((__format__ (__printf__, 5, 6)));
  27. /* If NULL, error will flush stdout, then print on stderr the program
  28. name, a colon and a space. Otherwise, error will call this
  29. function without parameters instead. */
  30. extern void (*error_print_progname) (void);
  31. /* This variable is incremented each time `error' is called. */
  32. extern unsigned int error_message_count;
  33. /* Sometimes we want to have at most one error per line. This
  34. variable controls whether this mode is selected or not. */
  35. extern int error_one_per_line;
  36. #include <bits/floatn.h>
  37. #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
  38. # include <bits/error-ldbl.h>
  39. #else
  40. /* Do not inline error and error_at_line when long double has the same
  41. size of double, nor when long double reuses the float128
  42. implementation, because that would invalidate the redirections to the
  43. compatibility functions. */
  44. # if defined __extern_always_inline && defined __va_arg_pack
  45. # include <bits/error.h>
  46. # endif
  47. #endif
  48. __END_DECLS
  49. #endif /* error.h */