error.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Declaration for error-reporting function
  2. Copyright (C) 1995-2020 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. #ifdef __LDBL_COMPAT
  37. # include <bits/error-ldbl.h>
  38. #else
  39. /* Do not inline error and error_at_line when long double has the same
  40. size of double, because that would invalidate the redirections to the
  41. compatibility functions. */
  42. # if defined __extern_always_inline && defined __va_arg_pack
  43. # include <bits/error.h>
  44. # endif
  45. #endif
  46. __END_DECLS
  47. #endif /* error.h */