]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Code cleaning: use #elif in coregrind/m_trampoline.S
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 11 Jan 2026 10:39:55 +0000 (11:39 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 11 Jan 2026 10:39:55 +0000 (11:39 +0100)
The code was using #else #if with an ever growing list of
Chained #elifs with just one #endif is nicer.

coregrind/m_trampoline.S

index 6ba42613e9a0c6402ddc0ab9c2fdc17f1687bb82..ec25136ef596c6dddbcdfbdafb8e43a0bb5c7e00 100644 (file)
@@ -144,8 +144,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
        
 /*---------------------- amd64-linux ----------------------*/
-#else
-#if defined(VGP_amd64_linux)
+#elif defined(VGP_amd64_linux)
 
 #      define UD2_16     ud2 ; ud2 ; ud2 ; ud2 ;ud2 ; ud2 ; ud2 ; ud2
 #      define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
@@ -356,8 +355,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
 
 /*---------------- ppc32-linux ----------------*/
-#else
-#if defined(VGP_ppc32_linux)
+#elif defined(VGP_ppc32_linux)
 
 #      define UD2_16     trap ; trap ; trap; trap
 #      define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
@@ -479,8 +477,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
 
 /*---------------- ppc64-linux ----------------*/
-#else
-#if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
+#elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
 
 #      define UD2_16     trap ; trap ; trap; trap
 #      define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
@@ -662,8 +659,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
 
 /*---------------- arm-linux ----------------*/
-#else
-#if defined(VGP_arm_linux)
+#elif defined(VGP_arm_linux)
 
 #       define UD2_4      .word 0xFFFFFFFF
 #      define UD2_16     UD2_4    ; UD2_4    ; UD2_4    ; UD2_4
@@ -839,8 +835,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
         
 /*---------------- arm64-linux ----------------*/
-#else
-#if defined(VGP_arm64_linux)
+#elif defined(VGP_arm64_linux)
 
 #       define UD2_4      .word 0xFFFFFFFF
 #      define UD2_16     UD2_4    ; UD2_4    ; UD2_4    ; UD2_4
@@ -939,8 +934,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
         
 /*---------------- x86-freebsd ----------------*/
-#else
-#if defined(VGP_x86_freebsd)
+#elif defined(VGP_x86_freebsd)
 
 .global VG_(trampoline_stuff_start)
 VG_(trampoline_stuff_start):
@@ -967,8 +961,7 @@ VG_(x86_freebsd_SUBST_FOR_sigreturn):
 .global VG_(trampoline_stuff_end)
 VG_(trampoline_stuff_end):
 
-#else
-#if defined(VGP_amd64_freebsd)
+#elif defined(VGP_amd64_freebsd)
 
 #      define UD2_16     ud2 ; ud2 ; ud2 ; ud2 ;ud2 ; ud2 ; ud2 ; ud2
 #      define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
@@ -1027,8 +1020,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
 
 /*---------------- arm64-freebsd ----------------*/
-#else
-#if defined(VGP_arm64_freebsd)
+#elif defined(VGP_arm64_freebsd)
 
 #       define UD2_4      .word 0xFFFFFFFF
 #      define UD2_16     UD2_4    ; UD2_4    ; UD2_4    ; UD2_4
@@ -1069,8 +1061,7 @@ VG_(trampoline_stuff_end):
 
 
 /*---------------- x86-darwin ----------------*/
-#else
-#if defined(VGP_x86_darwin)
+#elif defined(VGP_x86_darwin)
 
         /* a leading page of unexecutable code */
 .fill 2048, 2, 0x0b0f /* `ud2` */
@@ -1229,8 +1220,7 @@ VG_(trampoline_stuff_end):
 
 
 /*---------------- amd64-darwin ----------------*/
-#else
-#if defined(VGP_amd64_darwin)
+#elif defined(VGP_amd64_darwin)
 
         /* a leading page of unexecutable code */
 .fill 2048, 2, 0x0b0f /* `ud2` */
@@ -1400,8 +1390,7 @@ VG_(trampoline_stuff_end):
 
 
 /*---------------- s390x-linux ----------------*/
-#else
-#if defined(VGP_s390x_linux)
+#elif defined(VGP_s390x_linux)
 
         /* a leading page of unexecutable code */
        .fill 2048, 2, 0x0000
@@ -1455,8 +1444,7 @@ VG_(trampoline_stuff_end):
        .fill 2048, 2, 0x0000
 
 /*---------------------- mips32-linux ----------------------*/
-#else
-#if defined(VGP_mips32_linux)
+#elif defined(VGP_mips32_linux)
 
 #      define UD2_16     trap ; trap ; trap; trap
 #      define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
@@ -1532,8 +1520,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
 
 /*---------------------- nanomips-linux --------------------*/
-#else
-#if defined(VGP_nanomips_linux)
+#elif defined(VGP_nanomips_linux)
 
 .global VG_(trampoline_stuff_start)
 VG_(trampoline_stuff_start):
@@ -1581,8 +1568,7 @@ VG_(trampoline_stuff_end):
 
 
 /*---------------------- mips64-linux ----------------------*/
-#else
-#if defined(VGP_mips64_linux)
+#elif defined(VGP_mips64_linux)
 
 #       define UD2_16     trap ; trap ; trap; trap
 #       define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
@@ -1650,8 +1636,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
 
 /*---------------- riscv64-linux ----------------*/
-#else
-#if defined(VGP_riscv64_linux)
+#elif defined(VGP_riscv64_linux)
 
 #      define UD2_4      .word 0
 #      define UD2_16     UD2_4    ; UD2_4    ; UD2_4    ; UD2_4
@@ -1742,8 +1727,7 @@ VG_(trampoline_stuff_end):
 #      undef UD2_PAGE
 
 /*---------------- x86-solaris ----------------*/
-#else
-#if defined(VGP_x86_solaris)
+#elif defined(VGP_x86_solaris)
 
 .global VG_(trampoline_stuff_start)
 VG_(trampoline_stuff_start):
@@ -1796,8 +1780,7 @@ VG_(x86_solaris_REDIR_FOR_strlen):
 VG_(trampoline_stuff_end):
 
 /*---------------- amd64-solaris ----------------*/
-#else
-#if defined(VGP_amd64_solaris)
+#elif defined(VGP_amd64_solaris)
 
 .global VG_(trampoline_stuff_start)
 VG_(trampoline_stuff_start):
@@ -1924,23 +1907,6 @@ VG_(trampoline_stuff_end):
 #else
 #  error Unknown platform
 
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
 #endif
 
 /* Let the linker know we don't need an executable stack */