xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/bits/error.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /* Specializations for error functions.
2*53ee8cc1Swenshuai.xi    Copyright (C) 2007 Free Software Foundation, Inc.
3*53ee8cc1Swenshuai.xi    This file is part of the GNU C Library.
4*53ee8cc1Swenshuai.xi 
5*53ee8cc1Swenshuai.xi    The GNU C Library is free software; you can redistribute it and/or
6*53ee8cc1Swenshuai.xi    modify it under the terms of the GNU Lesser General Public
7*53ee8cc1Swenshuai.xi    License as published by the Free Software Foundation; either
8*53ee8cc1Swenshuai.xi    version 2.1 of the License, or (at your option) any later version.
9*53ee8cc1Swenshuai.xi 
10*53ee8cc1Swenshuai.xi    The GNU C Library is distributed in the hope that it will be useful,
11*53ee8cc1Swenshuai.xi    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*53ee8cc1Swenshuai.xi    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*53ee8cc1Swenshuai.xi    Lesser General Public License for more details.
14*53ee8cc1Swenshuai.xi 
15*53ee8cc1Swenshuai.xi    You should have received a copy of the GNU Lesser General Public
16*53ee8cc1Swenshuai.xi    License along with the GNU C Library; if not, write to the Free
17*53ee8cc1Swenshuai.xi    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18*53ee8cc1Swenshuai.xi    02111-1307 USA.  */
19*53ee8cc1Swenshuai.xi 
20*53ee8cc1Swenshuai.xi #ifndef	_ERROR_H
21*53ee8cc1Swenshuai.xi # error "Never include <bits/error.h> directly; use <error.h> instead."
22*53ee8cc1Swenshuai.xi #endif
23*53ee8cc1Swenshuai.xi 
24*53ee8cc1Swenshuai.xi 
25*53ee8cc1Swenshuai.xi extern void __REDIRECT (__error_alias, (int __status, int __errnum,
26*53ee8cc1Swenshuai.xi 					__const char *__format, ...),
27*53ee8cc1Swenshuai.xi 			error)
28*53ee8cc1Swenshuai.xi   __attribute__ ((__format__ (__printf__, 3, 4)));
29*53ee8cc1Swenshuai.xi extern void __REDIRECT (__error_noreturn, (int __status, int __errnum,
30*53ee8cc1Swenshuai.xi 					   __const char *__format, ...),
31*53ee8cc1Swenshuai.xi 			error)
32*53ee8cc1Swenshuai.xi   __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));
33*53ee8cc1Swenshuai.xi 
34*53ee8cc1Swenshuai.xi 
35*53ee8cc1Swenshuai.xi /* If we know the function will never return make sure the compiler
36*53ee8cc1Swenshuai.xi    realizes that, too.  */
37*53ee8cc1Swenshuai.xi __extern_always_inline void
error(int __status,int __errnum,__const char * __format,...)38*53ee8cc1Swenshuai.xi error (int __status, int __errnum, __const char *__format, ...)
39*53ee8cc1Swenshuai.xi {
40*53ee8cc1Swenshuai.xi   if (__builtin_constant_p (__status) && __status != 0)
41*53ee8cc1Swenshuai.xi     __error_noreturn (__status, __errnum, __format, __va_arg_pack ());
42*53ee8cc1Swenshuai.xi   else
43*53ee8cc1Swenshuai.xi     __error_alias (__status, __errnum, __format, __va_arg_pack ());
44*53ee8cc1Swenshuai.xi }
45*53ee8cc1Swenshuai.xi 
46*53ee8cc1Swenshuai.xi 
47*53ee8cc1Swenshuai.xi extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum,
48*53ee8cc1Swenshuai.xi 						__const char *__fname,
49*53ee8cc1Swenshuai.xi 						unsigned int __line,
50*53ee8cc1Swenshuai.xi 						__const char *__format, ...),
51*53ee8cc1Swenshuai.xi 			error_at_line)
52*53ee8cc1Swenshuai.xi   __attribute__ ((__format__ (__printf__, 5, 6)));
53*53ee8cc1Swenshuai.xi extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum,
54*53ee8cc1Swenshuai.xi 						   __const char *__fname,
55*53ee8cc1Swenshuai.xi 						   unsigned int __line,
56*53ee8cc1Swenshuai.xi 						   __const char *__format,
57*53ee8cc1Swenshuai.xi 						   ...),
58*53ee8cc1Swenshuai.xi 			error_at_line)
59*53ee8cc1Swenshuai.xi   __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6)));
60*53ee8cc1Swenshuai.xi 
61*53ee8cc1Swenshuai.xi 
62*53ee8cc1Swenshuai.xi /* If we know the function will never return make sure the compiler
63*53ee8cc1Swenshuai.xi    realizes that, too.  */
64*53ee8cc1Swenshuai.xi __extern_always_inline void
error_at_line(int __status,int __errnum,__const char * __fname,unsigned int __line,__const char * __format,...)65*53ee8cc1Swenshuai.xi error_at_line (int __status, int __errnum, __const char *__fname,
66*53ee8cc1Swenshuai.xi 	       unsigned int __line,__const char *__format, ...)
67*53ee8cc1Swenshuai.xi {
68*53ee8cc1Swenshuai.xi   if (__builtin_constant_p (__status) && __status != 0)
69*53ee8cc1Swenshuai.xi     __error_at_line_noreturn (__status, __errnum, __fname, __line, __format,
70*53ee8cc1Swenshuai.xi 			      __va_arg_pack ());
71*53ee8cc1Swenshuai.xi   else
72*53ee8cc1Swenshuai.xi     __error_at_line_alias (__status, __errnum, __fname, __line,
73*53ee8cc1Swenshuai.xi 			   __format, __va_arg_pack ());
74*53ee8cc1Swenshuai.xi }
75