1 /* Specializations for error functions.
2 Copyright (C) 2007 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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
21 # error "Never include <bits/error.h> directly; use <error.h> instead."
25 extern void __REDIRECT (__error_alias, (int __status, int __errnum,
26 __const char *__format, ...),
28 __attribute__ ((__format__ (__printf__, 3, 4)));
29 extern void __REDIRECT (__error_noreturn, (int __status, int __errnum,
30 __const char *__format, ...),
32 __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));
35 /* If we know the function will never return make sure the compiler
36 realizes that, too. */
37 __extern_always_inline void
38 error (int __status, int __errnum, __const char *__format, ...)
40 if (__builtin_constant_p (__status) && __status != 0)
41 __error_noreturn (__status, __errnum, __format, __va_arg_pack ());
43 __error_alias (__status, __errnum, __format, __va_arg_pack ());
47 extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum,
48 __const char *__fname,
50 __const char *__format, ...),
52 __attribute__ ((__format__ (__printf__, 5, 6)));
53 extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum,
54 __const char *__fname,
56 __const char *__format,
59 __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6)));
62 /* If we know the function will never return make sure the compiler
63 realizes that, too. */
64 __extern_always_inline void
65 error_at_line (int __status, int __errnum, __const char *__fname,
66 unsigned int __line,__const char *__format, ...)
68 if (__builtin_constant_p (__status) && __status != 0)
69 __error_at_line_noreturn (__status, __errnum, __fname, __line, __format,
72 __error_at_line_alias (__status, __errnum, __fname, __line,
73 __format, __va_arg_pack ());