diff options
author | Sachin Monga <smonga@linux.ibm.com> | 2023-05-10 13:59:21 -0400 |
---|---|---|
committer | Rajalakshmi Srinivasaraghavan <rajis@linux.ibm.com> | 2023-05-10 13:59:48 -0500 |
commit | 1a57ab0c923f269d1d7c29dfe4634c0ae66d69ac (patch) | |
tree | a99cd546a6a7948f9b937d62473c3d0928547f57 /misc/bits | |
parent | f0dbe112f532be2101bb392f67f9f164cade25b0 (diff) | |
download | glibc-1a57ab0c923f269d1d7c29dfe4634c0ae66d69ac.tar glibc-1a57ab0c923f269d1d7c29dfe4634c0ae66d69ac.tar.gz glibc-1a57ab0c923f269d1d7c29dfe4634c0ae66d69ac.tar.bz2 glibc-1a57ab0c923f269d1d7c29dfe4634c0ae66d69ac.zip |
Added Redirects to longdouble error functions [BZ #29033]
This patch redirects the error functions to the appropriate
longdouble variants which enables the compiler to optimize
for the abi ieeelongdouble.
Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Diffstat (limited to 'misc/bits')
-rw-r--r-- | misc/bits/error-ldbl.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/misc/bits/error-ldbl.h b/misc/bits/error-ldbl.h index 599a7d6e06..bbc4956f68 100644 --- a/misc/bits/error-ldbl.h +++ b/misc/bits/error-ldbl.h @@ -20,5 +20,50 @@ # error "Never include <bits/error-ldbl.h> directly; use <error.h> instead." #endif +#if defined __extern_always_inline && defined __va_arg_pack +extern void __REDIRECT_LDBL (__error_alias, (int __status, int __errnum, + const char *__format, ...), error) + __attribute__ ((__format__ (__printf__, 3, 4))); +extern void __REDIRECT_LDBL (__error_noreturn, (int __status, int __errnum, + const char *__format, ...), error) + __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4))); + + +/* If we know the function will never return make sure the compiler + realizes that, too. */ +__extern_always_inline void +error (int __status, int __errnum, const char *__format, ...) +{ + if (__builtin_constant_p (__status) && __status != 0) + __error_noreturn (__status, __errnum, __format, __va_arg_pack ()); + else + __error_alias (__status, __errnum, __format, __va_arg_pack ()); +} + + +extern void __REDIRECT_LDBL (__error_at_line_alias, (int __status, int __errnum, + const char *__fname, unsigned int __line, + const char *__format, ...), error_at_line) + __attribute__ ((__format__ (__printf__, 5, 6))); +extern void __REDIRECT_LDBL (__error_at_line_noreturn, (int __status, int __errnum, + const char *__fname, unsigned int __line, + const char *__format, ...), error_at_line) + __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6))); + + +/* If we know the function will never return make sure the compiler + realizes that, too. */ +__extern_always_inline void +error_at_line (int __status, int __errnum, const char *__fname, + unsigned int __line, const char *__format, ...) +{ + if (__builtin_constant_p (__status) && __status != 0) + __error_at_line_noreturn (__status, __errnum, __fname, __line, __format, + __va_arg_pack ()); + else + __error_at_line_alias (__status, __errnum, __fname, __line, + __format, __va_arg_pack ()); +} +#endif __LDBL_REDIR_DECL (error) __LDBL_REDIR_DECL (error_at_line) |