[v2,18.1/34] hurd: Do not declare local variables volatile

Message ID 20230403115621.258636-2-bugaevc@gmail.com
State Committed, archived
Headers
Series Alignment-respecting x86_64 trampoline.c |

Commit Message

Sergey Bugaev April 3, 2023, 11:56 a.m. UTC
  These are just regular local variables that are not accessed in any
funny ways, not even though a pointer. There's absolutely no reason to
declare them volatile. It only ends up hurting the quality of the
generated machine code.

If anything, it would make sense to decalre sigsp as *pointing* to
volatile memory (volatile void *sigsp), but evidently that's not needed
either.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
 hurd/trampoline.c                   | 2 +-
 sysdeps/mach/hurd/i386/trampoline.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Samuel Thibault April 10, 2023, 6:42 p.m. UTC | #1
Applied, thanks!

Sergey Bugaev, le lun. 03 avril 2023 14:56:20 +0300, a ecrit:
> These are just regular local variables that are not accessed in any
> funny ways, not even though a pointer. There's absolutely no reason to
> declare them volatile. It only ends up hurting the quality of the
> generated machine code.
> 
> If anything, it would make sense to decalre sigsp as *pointing* to
> volatile memory (volatile void *sigsp), but evidently that's not needed
> either.
> 
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
>  hurd/trampoline.c                   | 2 +-
>  sysdeps/mach/hurd/i386/trampoline.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hurd/trampoline.c b/hurd/trampoline.c
> index 5bd8dec9..1447b13f 100644
> --- a/hurd/trampoline.c
> +++ b/hurd/trampoline.c
> @@ -29,7 +29,7 @@ struct sigcontext *
>  _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action,
>                          __sighandler_t handler,
>                          int signo, struct hurd_signal_detail *detail,
> -                        volatile int rpc_wait,
> +                        int rpc_wait,
>                          struct machine_thread_all_state *state)
>  {
>  #error "Need to write sysdeps/mach/hurd/MACHINE/trampoline.c"
> diff --git a/sysdeps/mach/hurd/i386/trampoline.c b/sysdeps/mach/hurd/i386/trampoline.c
> index ab67fb9c..9cd60b9c 100644
> --- a/sysdeps/mach/hurd/i386/trampoline.c
> +++ b/sysdeps/mach/hurd/i386/trampoline.c
> @@ -83,13 +83,13 @@ struct sigcontext *
>  _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action,
>  			__sighandler_t handler,
>  			int signo, struct hurd_signal_detail *detail,
> -			volatile int rpc_wait,
> +			int rpc_wait,
>  			struct machine_thread_all_state *state)
>  {
>    void trampoline (void);
>    void rpc_wait_trampoline (void);
>    void firewall (void);
> -  void *volatile sigsp;
> +  void *sigsp;
>    struct sigcontext *scp;
>    struct
>      {
> -- 
> 2.39.2
>
  

Patch

diff --git a/hurd/trampoline.c b/hurd/trampoline.c
index 5bd8dec9..1447b13f 100644
--- a/hurd/trampoline.c
+++ b/hurd/trampoline.c
@@ -29,7 +29,7 @@  struct sigcontext *
 _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action,
                         __sighandler_t handler,
                         int signo, struct hurd_signal_detail *detail,
-                        volatile int rpc_wait,
+                        int rpc_wait,
                         struct machine_thread_all_state *state)
 {
 #error "Need to write sysdeps/mach/hurd/MACHINE/trampoline.c"
diff --git a/sysdeps/mach/hurd/i386/trampoline.c b/sysdeps/mach/hurd/i386/trampoline.c
index ab67fb9c..9cd60b9c 100644
--- a/sysdeps/mach/hurd/i386/trampoline.c
+++ b/sysdeps/mach/hurd/i386/trampoline.c
@@ -83,13 +83,13 @@  struct sigcontext *
 _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action,
 			__sighandler_t handler,
 			int signo, struct hurd_signal_detail *detail,
-			volatile int rpc_wait,
+			int rpc_wait,
 			struct machine_thread_all_state *state)
 {
   void trampoline (void);
   void rpc_wait_trampoline (void);
   void firewall (void);
-  void *volatile sigsp;
+  void *sigsp;
   struct sigcontext *scp;
   struct
     {