From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1792) id B48F53858D28; Mon, 1 May 2023 17:33:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B48F53858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682962423; bh=NTnRb0gZ5eAwO+TA0sXgWgsaRQVVgexwZT+M9g7th/8=; h=From:To:Subject:Date:From; b=lKWTVK8jho4UlY6EBzCVTHMqdoD3++HXwdIT7TbIGPHuF331lacNe6mI48t8ZWDCW HmK5/K4BYIDBcH+iKPNJFeyg7OMlwva2/iaGv+XwSJ8Epv551YW/uTjgJRwJtL+cDG 5/rdhgt/cyOsD4DTM3ak19gQJMShAg0Avfg2oUZ8= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Samuel Thibault To: glibc-cvs@sourceware.org Subject: [glibc] Mark various cold functions as __COLD X-Act-Checkin: glibc X-Git-Author: Sergey Bugaev X-Git-Refname: refs/heads/master X-Git-Oldrev: be9ad3004f65b54dd6cc0325315559c72396bc1c X-Git-Newrev: e6a252758cbadb13654e66e1f2445ef6f8a4dea0 Message-Id: <20230501173343.B48F53858D28@sourceware.org> Date: Mon, 1 May 2023 17:33:43 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e6a252758cbadb13654e66e1f2445ef6f8a4dea0 commit e6a252758cbadb13654e66e1f2445ef6f8a4dea0 Author: Sergey Bugaev Date: Sat Apr 29 16:12:23 2023 +0300 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 Signed-off-by: Sergey Bugaev Message-Id: <20230429131223.2507236-3-bugaevc@gmail.com> Diff: --- include/error.h | 4 ++-- libio/stdio.h | 2 +- misc/err.h | 12 ++++++------ misc/error.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/error.h b/include/error.h index 9e96262fc5..4db67cba90 100644 --- a/include/error.h +++ b/include/error.h @@ -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 diff --git a/libio/stdio.h b/libio/stdio.h index 45ddafdf20..2387590d6a 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -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 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 #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