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