]> granicus.if.org Git - strace/commitdiff
Simplify getllval ifdefery
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2016 16:54:31 +0000 (16:54 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2016 16:54:31 +0000 (16:54 +0000)
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.

* util.c (getllval): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.

util.c

diff --git a/util.c b/util.c
index e09991ff4162a6064059ce2d5944fa0bc7409437..71ee4f9f100a8da8102d5cff2f4f71b3fd6b18df 100644 (file)
--- a/util.c
+++ b/util.c
@@ -296,9 +296,9 @@ printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
 int
 getllval(struct tcb *tcp, unsigned long long *val, int arg_no)
 {
-#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+#if SIZEOF_KERNEL_LONG_T > 4
 # ifndef current_klongsize
-       if (current_klongsize < SIZEOF_LONG) {
+       if (current_klongsize < SIZEOF_KERNEL_LONG_T) {
 #  if defined(AARCH64) || defined(POWERPC64)
                /* Align arg_no to the next even number. */
                arg_no = (arg_no + 1) & 0xe;
@@ -311,20 +311,7 @@ getllval(struct tcb *tcp, unsigned long long *val, int arg_no)
                *val = tcp->u_arg[arg_no];
                arg_no++;
        }
-#elif SIZEOF_LONG > 4
-#  error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
-#elif SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
-# ifndef current_klongsize
-       if (current_klongsize < SIZEOF_KERNEL_LONG_T) {
-               *val = ULONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]);
-               arg_no += 2;
-       } else
-# endif /* !current_klongsize */
-       {
-               *val = tcp->u_arg[arg_no];
-               arg_no++;
-       }
-#else
+#else /* SIZEOF_KERNEL_LONG_T == 4 */
 # if defined __ARM_EABI__ || \
      defined LINUX_MIPSO32 || \
      defined POWERPC || \