]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Mark various cold functions as __COLD
authorSergey Bugaev <bugaevc@gmail.com>
Sat, 29 Apr 2023 13:12:23 +0000 (16:12 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 1 May 2023 17:33:21 +0000 (19:33 +0200)
GCC docs explicitly list perror () as a good candidate for using
__attribute__ ((cold)). So apply __COLD to perror () and similar
functions.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230429131223.2507236-3-bugaevc@gmail.com>

include/error.h
libio/stdio.h
misc/err.h
misc/error.h

index 9e96262fc5ac3aa4e4b28911d02f3a9cc91f4aae..4db67cba903688f142c05773fdd65d7e32462113 100644 (file)
@@ -5,11 +5,11 @@
 
 void
 __error_internal (int status, int errnum, const char *message,
-                 va_list args, unsigned int mode_flags);
+                 va_list args, unsigned int mode_flags) __COLD;
 
 void
 __error_at_line_internal (int status, int errnum, const char *file_name,
                          unsigned int line_number, const char *message,
-                         va_list args, unsigned int mode_flags);
+                         va_list args, unsigned int mode_flags) __COLD;
 
 #endif
index 45ddafdf20558c2bd3b61a6f264c928905b640b9..2387590d6a7cf3a26dd518ef0745337cb5c0c509 100644 (file)
@@ -859,7 +859,7 @@ extern int ferror_unlocked (FILE *__stream) __THROW __wur;
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern void perror (const char *__s);
+extern void perror (const char *__s) __COLD;
 
 
 #ifdef __USE_POSIX
index 0c752465eeb82c330e57bdabf2ffb75cbb832317..43df3a571b3d18834ad1ff5f969ab49ed4595250 100644 (file)
@@ -32,9 +32,9 @@ __BEGIN_DECLS
 /* Print "program: ", FORMAT, ": ", the standard error string for errno,
    and a newline, on stderr.  */
 extern void warn (const char *__format, ...)
-     __attribute__ ((__format__ (__printf__, 1, 2)));
+     __attribute__ ((__format__ (__printf__, 1, 2))) __COLD;
 extern void vwarn (const char *__format, __gnuc_va_list)
-     __attribute__ ((__format__ (__printf__, 1, 0)));
+     __attribute__ ((__format__ (__printf__, 1, 0))) __COLD;
 
 /* Likewise, but without ": " and the standard error string.  */
 extern void warnx (const char *__format, ...)
@@ -44,13 +44,13 @@ extern void vwarnx (const char *__format, __gnuc_va_list)
 
 /* Likewise, and then exit with STATUS.  */
 extern void err (int __status, const char *__format, ...)
-     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))) __COLD;
 extern void verr (int __status, const char *__format, __gnuc_va_list)
-     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))) __COLD;
 extern void errx (int __status, const char *__format, ...)
-     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))) __COLD;
 extern void verrx (int __status, const char *, __gnuc_va_list)
-     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+     __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))) __COLD;
 
 #include <bits/floatn.h>
 #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
index 185b39c641799d3dd0e0266088bdb18ba18b914a..4fbd46c7750159f8ac02156cb428bf659a9df1fe 100644 (file)
@@ -29,11 +29,11 @@ __BEGIN_DECLS
    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
 
 extern void error (int __status, int __errnum, const char *__format, ...)
-     __attribute__ ((__format__ (__printf__, 3, 4)));
+     __attribute__ ((__format__ (__printf__, 3, 4))) __COLD;
 
 extern void error_at_line (int __status, int __errnum, const char *__fname,
                           unsigned int __lineno, const char *__format, ...)
-     __attribute__ ((__format__ (__printf__, 5, 6)));
+     __attribute__ ((__format__ (__printf__, 5, 6))) __COLD;
 
 /* If NULL, error will flush stdout, then print on stderr the program
    name, a colon and a space.  Otherwise, error will call this