4
0

error.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Declaration for error-reporting function
  2. Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program 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
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License along
  13. with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  15. #ifndef _ERROR_H
  16. #define _ERROR_H 1
  17. #ifndef __attribute__
  18. /* This feature is available in gcc versions 2.5 and later. */
  19. # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
  20. # define __attribute__(Spec) /* empty */
  21. # endif
  22. /* The __-protected variants of `format' and `printf' attributes
  23. are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
  24. # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
  25. # define __format__ format
  26. # define __printf__ printf
  27. # endif
  28. #endif
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* Print a message with `fprintf (stderr, FORMAT, ...)';
  33. if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
  34. If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
  35. extern void error (int __status, int __errnum, const char *__format, ...)
  36. __attribute__ ((__format__ (__printf__, 3, 4)));
  37. extern void error_at_line (int __status, int __errnum, const char *__fname,
  38. unsigned int __lineno, const char *__format, ...)
  39. __attribute__ ((__format__ (__printf__, 5, 6)));
  40. /* If NULL, error will flush stdout, then print on stderr the program
  41. name, a colon and a space. Otherwise, error will call this
  42. function without parameters instead. */
  43. extern void (*error_print_progname) (void);
  44. /* This variable is incremented each time `error' is called. */
  45. extern unsigned int error_message_count;
  46. /* Sometimes we want to have at most one error per line. This
  47. variable controls whether this mode is selected or not. */
  48. extern int error_one_per_line;
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif /* error.h */