public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Sergey Bugaev <bugaevc@gmail.com>
Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org
Subject: Re: [PATCH 3/3] Mark various cold functions as __COLD
Date: Sat, 29 Apr 2023 17:06:55 +0200	[thread overview]
Message-ID: <20230429150655.uhvqgh4j56vsnshv@begin> (raw)
In-Reply-To: <20230429131223.2507236-3-bugaevc@gmail.com>

It looks sensible to me indeed, any opinion from somebody else?




Sergey Bugaev, le sam. 29 avril 2023 16:12:23 +0300, a ecrit:
> GCC docs explicitly list perror () as a good candidate for using
> __attribute__ ((cold)). So apply __COLD to perror () and similar
> functions.
> 
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
>  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 9e96262f..4db67cba 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 45ddafdf..2387590d 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 0c752465..43df3a57 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 185b39c6..4fbd46c7 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
> -- 
> 2.40.1
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.

  reply	other threads:[~2023-04-29 15:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29 13:12 [PATCH 1/3] cdefs.h: Define __COLD Sergey Bugaev
2023-04-29 13:12 ` [PATCH 2/3] hurd: Mark error functions as __COLD Sergey Bugaev
2023-04-29 15:04   ` Samuel Thibault
2023-04-29 13:12 ` [PATCH 3/3] Mark various cold " Sergey Bugaev
2023-04-29 15:06   ` Samuel Thibault [this message]
2023-05-01 16:15     ` Siddhesh Poyarekar
2023-05-01 17:38       ` Samuel Thibault
2023-05-01 21:52   ` Cristian Rodríguez
2023-05-01 21:54     ` Samuel Thibault
2023-05-02  6:45       ` Sergey Bugaev
2023-04-29 13:20 ` [PATCH] cdefs.h: Define __COLD Sergey Bugaev
2023-04-29 15:02   ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230429150655.uhvqgh4j56vsnshv@begin \
    --to=samuel.thibault@gnu.org \
    --cc=bug-hurd@gnu.org \
    --cc=bugaevc@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).