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