]> sourceware.org Git - glibc.git/commitdiff
assert: Mark `__assert_fail` as `cold`
authorNoah Goldstein <goldstein.w.n@gmail.com>
Fri, 26 Jul 2024 08:35:13 +0000 (16:35 +0800)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Fri, 26 Jul 2024 12:41:00 +0000 (20:41 +0800)
This helps compilers split the codegen for setting up the arguments
(`__expression`, `__filename`, etc...) from the potentially hot cold
where the `assert` is to a presumably cold region on the assertion
failure path.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Sam James <sam@gentoo.org>
assert/assert.h

index 266a41df063e9a4ab0734544c72fa9887012d5fe..14d3be9cac24f80a88608c334cda9b373d76a2a6 100644 (file)
@@ -66,18 +66,18 @@ __BEGIN_DECLS
 /* This prints an "Assertion failed" message and aborts.  */
 extern void __assert_fail (const char *__assertion, const char *__file,
                           unsigned int __line, const char *__function)
-     __THROW __attribute__ ((__noreturn__));
+     __THROW __attribute__ ((__noreturn__)) __COLD;
 
 /* Likewise, but prints the error text for ERRNUM.  */
 extern void __assert_perror_fail (int __errnum, const char *__file,
                                  unsigned int __line, const char *__function)
-     __THROW __attribute__ ((__noreturn__));
+     __THROW __attribute__ ((__noreturn__)) __COLD;
 
 
 /* The following is not at all used here but needed for standard
    compliance.  */
 extern void __assert (const char *__assertion, const char *__file, int __line)
-     __THROW __attribute__ ((__noreturn__));
+     __THROW __attribute__ ((__noreturn__)) __COLD;
 
 
 __END_DECLS
This page took 0.045389 seconds and 5 git commands to generate.