master
1/* Redirections for error.h functions for -mlong-double-64.
2 Copyright (C) 2019-2025 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, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _ERROR_H
20# error "Never include <bits/error-ldbl.h> directly; use <error.h> instead."
21#endif
22
23#if defined __extern_always_inline && defined __va_arg_pack
24extern void __REDIRECT_LDBL (__error_alias, (int __status, int __errnum,
25 const char *__format, ...), error)
26 __attribute__ ((__format__ (__printf__, 3, 4)));
27extern void __REDIRECT_LDBL (__error_noreturn, (int __status, int __errnum,
28 const char *__format, ...), error)
29 __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));
30
31
32/* If we know the function will never return make sure the compiler
33 realizes that, too. */
34__extern_always_inline void
35error (int __status, int __errnum, const char *__format, ...)
36{
37 if (__builtin_constant_p (__status) && __status != 0)
38 __error_noreturn (__status, __errnum, __format, __va_arg_pack ());
39 else
40 __error_alias (__status, __errnum, __format, __va_arg_pack ());
41}
42
43
44extern void __REDIRECT_LDBL (__error_at_line_alias, (int __status, int __errnum,
45 const char *__fname, unsigned int __line,
46 const char *__format, ...), error_at_line)
47 __attribute__ ((__format__ (__printf__, 5, 6)));
48extern void __REDIRECT_LDBL (__error_at_line_noreturn, (int __status, int __errnum,
49 const char *__fname, unsigned int __line,
50 const char *__format, ...), error_at_line)
51 __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6)));
52
53
54/* If we know the function will never return make sure the compiler
55 realizes that, too. */
56__extern_always_inline void
57error_at_line (int __status, int __errnum, const char *__fname,
58 unsigned int __line, const char *__format, ...)
59{
60 if (__builtin_constant_p (__status) && __status != 0)
61 __error_at_line_noreturn (__status, __errnum, __fname, __line, __format,
62 __va_arg_pack ());
63 else
64 __error_at_line_alias (__status, __errnum, __fname, __line,
65 __format, __va_arg_pack ());
66}
67#endif
68__LDBL_REDIR_DECL (error)
69__LDBL_REDIR_DECL (error_at_line)