error-ldbl.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Redirections for error.h functions for -mlong-double-64.
  2. Copyright (C) 2019-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _ERROR_H
  16. # error "Never include <bits/error-ldbl.h> directly; use <error.h> instead."
  17. #endif
  18. #if defined __extern_always_inline && defined __va_arg_pack
  19. extern void __REDIRECT_LDBL (__error_alias, (int __status, int __errnum,
  20. const char *__format, ...), error)
  21. __attribute__ ((__format__ (__printf__, 3, 4)));
  22. extern void __REDIRECT_LDBL (__error_noreturn, (int __status, int __errnum,
  23. const char *__format, ...), error)
  24. __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));
  25. /* If we know the function will never return make sure the compiler
  26. realizes that, too. */
  27. __extern_always_inline void
  28. error (int __status, int __errnum, const char *__format, ...)
  29. {
  30. if (__builtin_constant_p (__status) && __status != 0)
  31. __error_noreturn (__status, __errnum, __format, __va_arg_pack ());
  32. else
  33. __error_alias (__status, __errnum, __format, __va_arg_pack ());
  34. }
  35. extern void __REDIRECT_LDBL (__error_at_line_alias, (int __status, int __errnum,
  36. const char *__fname, unsigned int __line,
  37. const char *__format, ...), error_at_line)
  38. __attribute__ ((__format__ (__printf__, 5, 6)));
  39. extern void __REDIRECT_LDBL (__error_at_line_noreturn, (int __status, int __errnum,
  40. const char *__fname, unsigned int __line,
  41. const char *__format, ...), error_at_line)
  42. __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6)));
  43. /* If we know the function will never return make sure the compiler
  44. realizes that, too. */
  45. __extern_always_inline void
  46. error_at_line (int __status, int __errnum, const char *__fname,
  47. unsigned int __line, const char *__format, ...)
  48. {
  49. if (__builtin_constant_p (__status) && __status != 0)
  50. __error_at_line_noreturn (__status, __errnum, __fname, __line, __format,
  51. __va_arg_pack ());
  52. else
  53. __error_at_line_alias (__status, __errnum, __fname, __line,
  54. __format, __va_arg_pack ());
  55. }
  56. #endif
  57. __LDBL_REDIR_DECL (error)
  58. __LDBL_REDIR_DECL (error_at_line)