about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-04-29 16:12:23 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-01 19:33:21 +0200
commite6a252758cbadb13654e66e1f2445ef6f8a4dea0 (patch)
tree77062c96855e8d5d81160ffc2b278753b267033d /misc
parentbe9ad3004f65b54dd6cc0325315559c72396bc1c (diff)
downloadglibc-e6a252758cbadb13654e66e1f2445ef6f8a4dea0.tar.gz
glibc-e6a252758cbadb13654e66e1f2445ef6f8a4dea0.tar.xz
glibc-e6a252758cbadb13654e66e1f2445ef6f8a4dea0.zip
Mark various cold functions as __COLD
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>
Diffstat (limited to 'misc')
-rw-r--r--misc/err.h12
-rw-r--r--misc/error.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/misc/err.h b/misc/err.h
index 0c752465ee..43df3a571b 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -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
diff --git a/misc/error.h b/misc/error.h
index 185b39c641..4fbd46c775 100644
--- a/misc/error.h
+++ b/misc/error.h
@@ -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