Back to index

glibc  2.9
error.h
Go to the documentation of this file.
00001 /* Specializations for error functions.
00002    Copyright (C) 2007 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef       _ERROR_H
00021 # error "Never include <bits/error.h> directly; use <error.h> instead."
00022 #endif
00023 
00024 
00025 extern void __REDIRECT (__error_alias, (int __status, int __errnum,
00026                                    __const char *__format, ...),
00027                      error)
00028   __attribute__ ((__format__ (__printf__, 3, 4)));
00029 extern void __REDIRECT (__error_noreturn, (int __status, int __errnum,
00030                                       __const char *__format, ...),
00031                      error)
00032   __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));
00033 
00034 
00035 /* If we know the function will never return make sure the compiler
00036    realizes that, too.  */
00037 __extern_always_inline void
00038 error (int __status, int __errnum, __const char *__format, ...)
00039 {
00040   if (__builtin_constant_p (__status) && __status != 0)
00041     __error_noreturn (__status, __errnum, __format, __va_arg_pack ());
00042   else
00043     __error_alias (__status, __errnum, __format, __va_arg_pack ());
00044 }
00045 
00046 
00047 extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum,
00048                                           __const char *__fname,
00049                                           unsigned int __line,
00050                                           __const char *__format, ...),
00051                      error_at_line)
00052   __attribute__ ((__format__ (__printf__, 5, 6)));
00053 extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum,
00054                                              __const char *__fname,
00055                                              unsigned int __line,
00056                                              __const char *__format,
00057                                              ...),
00058                      error_at_line)
00059   __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6)));
00060 
00061 
00062 /* If we know the function will never return make sure the compiler
00063    realizes that, too.  */
00064 __extern_always_inline void
00065 error_at_line (int __status, int __errnum, __const char *__fname,
00066               unsigned int __line,__const char *__format, ...)
00067 {
00068   if (__builtin_constant_p (__status) && __status != 0)
00069     __error_at_line_noreturn (__status, __errnum, __fname, __line, __format,
00070                            __va_arg_pack ());
00071   else
00072     __error_at_line_alias (__status, __errnum, __fname, __line,
00073                         __format, __va_arg_pack ());
00074 }