[2/3] hurd: Mark error functions as __COLD

Message ID 20230429131223.2507236-2-bugaevc@gmail.com
State Committed, archived
Headers
Series [1/3] cdefs.h: Define __COLD |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Sergey Bugaev April 29, 2023, 1:12 p.m. UTC
  This should hopefully hint the compiler that they are unlikely
to be called.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
 hurd/hurd.h    | 2 +-
 hurd/hurd/fd.h | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

Samuel Thibault April 29, 2023, 3:04 p.m. UTC | #1
Applied, thanks!

Sergey Bugaev, le sam. 29 avril 2023 16:12:22 +0300, a ecrit:
> This should hopefully hint the compiler that they are unlikely
> to be called.
> 
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
>  hurd/hurd.h    | 2 +-
>  hurd/hurd/fd.h | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/hurd/hurd.h b/hurd/hurd.h
> index eca4abb7..06f00e93 100644
> --- a/hurd/hurd.h
> +++ b/hurd/hurd.h
> @@ -48,7 +48,7 @@
>  #define _HURD_H_EXTERN_INLINE __extern_inline
>  #endif
>  
> -extern int __hurd_fail (error_t err);
> +extern int __hurd_fail (error_t err) __COLD;
>  
>  #ifdef __USE_EXTERN_INLINES
>  _HURD_H_EXTERN_INLINE int
> diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
> index f6139544..241797bf 100644
> --- a/hurd/hurd/fd.h
> +++ b/hurd/hurd/fd.h
> @@ -149,7 +149,7 @@ _hurd_fd_get (int fd)
>  /* Check if ERR should generate a signal.
>     Returns the signal to take, or zero if none.  */
>  
> -extern int _hurd_fd_error_signal (error_t err);
> +extern int _hurd_fd_error_signal (error_t err) __COLD;
>  
>  #ifdef __USE_EXTERN_INLINES
>  _HURD_FD_H_EXTERN_INLINE int
> @@ -174,7 +174,7 @@ _hurd_fd_error_signal (error_t err)
>     always use this function to handle errors from RPCs made on file
>     descriptor ports.  Some errors are translated into signals.  */
>  
> -extern error_t _hurd_fd_error (int fd, error_t err);
> +extern error_t _hurd_fd_error (int fd, error_t err) __COLD;
>  
>  #ifdef __USE_EXTERN_INLINES
>  _HURD_FD_H_EXTERN_INLINE error_t
> @@ -194,7 +194,7 @@ _hurd_fd_error (int fd, error_t err)
>  /* Handle error code ERR from an RPC on file descriptor FD's port.
>     Set `errno' to the appropriate error code, and always return -1.  */
>  
> -extern int __hurd_dfail (int fd, error_t err);
> +extern int __hurd_dfail (int fd, error_t err) __COLD;
>  
>  #ifdef __USE_EXTERN_INLINES
>  _HURD_FD_H_EXTERN_INLINE int
> @@ -208,7 +208,7 @@ __hurd_dfail (int fd, error_t err)
>  /* Likewise, but do not raise SIGPIPE on EPIPE if flags contain
>     MSG_NOSIGNAL.  */
>  
> -extern int __hurd_sockfail (int fd, int flags, error_t err);
> +extern int __hurd_sockfail (int fd, int flags, error_t err) __COLD;
>  
>  #ifdef __USE_EXTERN_INLINES
>  _HURD_FD_H_EXTERN_INLINE int
> -- 
> 2.40.1
>
  

Patch

diff --git a/hurd/hurd.h b/hurd/hurd.h
index eca4abb7..06f00e93 100644
--- a/hurd/hurd.h
+++ b/hurd/hurd.h
@@ -48,7 +48,7 @@ 
 #define _HURD_H_EXTERN_INLINE __extern_inline
 #endif
 
-extern int __hurd_fail (error_t err);
+extern int __hurd_fail (error_t err) __COLD;
 
 #ifdef __USE_EXTERN_INLINES
 _HURD_H_EXTERN_INLINE int
diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
index f6139544..241797bf 100644
--- a/hurd/hurd/fd.h
+++ b/hurd/hurd/fd.h
@@ -149,7 +149,7 @@  _hurd_fd_get (int fd)
 /* Check if ERR should generate a signal.
    Returns the signal to take, or zero if none.  */
 
-extern int _hurd_fd_error_signal (error_t err);
+extern int _hurd_fd_error_signal (error_t err) __COLD;
 
 #ifdef __USE_EXTERN_INLINES
 _HURD_FD_H_EXTERN_INLINE int
@@ -174,7 +174,7 @@  _hurd_fd_error_signal (error_t err)
    always use this function to handle errors from RPCs made on file
    descriptor ports.  Some errors are translated into signals.  */
 
-extern error_t _hurd_fd_error (int fd, error_t err);
+extern error_t _hurd_fd_error (int fd, error_t err) __COLD;
 
 #ifdef __USE_EXTERN_INLINES
 _HURD_FD_H_EXTERN_INLINE error_t
@@ -194,7 +194,7 @@  _hurd_fd_error (int fd, error_t err)
 /* Handle error code ERR from an RPC on file descriptor FD's port.
    Set `errno' to the appropriate error code, and always return -1.  */
 
-extern int __hurd_dfail (int fd, error_t err);
+extern int __hurd_dfail (int fd, error_t err) __COLD;
 
 #ifdef __USE_EXTERN_INLINES
 _HURD_FD_H_EXTERN_INLINE int
@@ -208,7 +208,7 @@  __hurd_dfail (int fd, error_t err)
 /* Likewise, but do not raise SIGPIPE on EPIPE if flags contain
    MSG_NOSIGNAL.  */
 
-extern int __hurd_sockfail (int fd, int flags, error_t err);
+extern int __hurd_sockfail (int fd, int flags, error_t err) __COLD;
 
 #ifdef __USE_EXTERN_INLINES
 _HURD_FD_H_EXTERN_INLINE int