From: Dmitry V. Levin Date: Thu, 11 Jul 2019 17:51:22 +0000 (+0000) Subject: Fix preprocessor indentation X-Git-Tag: v5.2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b63700cc56770866f3ba116707d229790aef43df;p=strace Fix preprocessor indentation Indent the C preprocessor directives to reflect their nesting using the following script: $ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do cppi < "$f" > "$f".cppi; mv "$f".cppi "$f" done --- diff --git a/defs.h b/defs.h index b6140fe0..93b35d71 100644 --- a/defs.h +++ b/defs.h @@ -1460,12 +1460,12 @@ popcount32(const uint32_t *a, unsigned int size) for (; size; ++a, --size) { uint32_t x = *a; -#ifdef HAVE___BUILTIN_POPCOUNT +# ifdef HAVE___BUILTIN_POPCOUNT count += __builtin_popcount(x); -#else +# else for (; x; ++count) x &= x - 1; -#endif +# endif } return count; diff --git a/kernel_timex.h b/kernel_timex.h index a597e353..11b29e02 100644 --- a/kernel_timex.h +++ b/kernel_timex.h @@ -37,7 +37,7 @@ typedef struct { int pad3[11]; } kernel_timex64_t; -#ifdef SPARC64 +# ifdef SPARC64 typedef struct { unsigned int modes; @@ -69,7 +69,7 @@ typedef struct { int pad3[11]; } kernel_sparc64_timex_t; -#endif /* SPARC64 */ +# endif /* SPARC64 */ # if HAVE_ARCH_TIME32_SYSCALLS diff --git a/linux/csky/raw_syscall.h b/linux/csky/raw_syscall.h index aad0abdc..0ffb83ca 100644 --- a/linux/csky/raw_syscall.h +++ b/linux/csky/raw_syscall.h @@ -6,18 +6,18 @@ */ #ifndef STRACE_RAW_SYSCALL_H -#define STRACE_RAW_SYSCALL_H +# define STRACE_RAW_SYSCALL_H # include "kernel_types.h" static inline kernel_ulong_t raw_syscall_0(const kernel_ulong_t nr, kernel_ulong_t *err) { -#if defined(__CSKYABIV2__) +# if defined(__CSKYABIV2__) register kernel_ulong_t scno __asm__("r7") = nr; -#else +# else register kernel_ulong_t scno __asm__("r1") = nr; -#endif +# endif register kernel_ulong_t a0 __asm__("a0"); asm volatile("trap 0" : "+r"(scno), "=r"(a0) diff --git a/syscall.c b/syscall.c index 3a31c3cb..e020b180 100644 --- a/syscall.c +++ b/syscall.c @@ -580,10 +580,10 @@ syscall_entering_decode(struct tcb *tcp) return res; } -# ifdef SYS_syscall_subcall +#ifdef SYS_syscall_subcall if (tcp_sysent(tcp)->sen == SEN_syscall) decode_syscall_subcall(tcp); -# endif +#endif #if defined SYS_ipc_subcall \ || defined SYS_socket_subcall switch (tcp_sysent(tcp)->sen) { diff --git a/tests/clone-flags.c b/tests/clone-flags.c index b7475cfd..04bb2c76 100644 --- a/tests/clone-flags.c +++ b/tests/clone-flags.c @@ -50,14 +50,14 @@ wait_cloned(pid_t pid, int sig, const char *text) #ifdef IA64 extern int __clone2(int (*)(void *), void *, size_t, int, void *, ...); -#define do_clone(fn_, stack_, size_, flags_, arg_, ...) \ +# define do_clone(fn_, stack_, size_, flags_, arg_, ...) \ wait_cloned(__clone2((fn_), (stack_), (size_), (flags_), (arg_), \ ## __VA_ARGS__), (flags_) & 0xff, #flags_) # define SYSCALL_NAME "clone2" # define STACK_SIZE_FMT ", stack_size=%#lx" # define STACK_SIZE_ARG child_stack_size, #else -#define do_clone(fn_, stack_, size_, flags_, arg_, ...) \ +# define do_clone(fn_, stack_, size_, flags_, arg_, ...) \ wait_cloned(clone((fn_), (stack_), (flags_), (arg_), \ ## __VA_ARGS__), (flags_) & 0xff, #flags_) # define SYSCALL_NAME "clone" diff --git a/tests/fspick.c b/tests/fspick.c index e794458f..35a75f6b 100644 --- a/tests/fspick.c +++ b/tests/fspick.c @@ -69,21 +69,21 @@ main(void) dfd, path, fname, "0xfffffff0 /* FSPICK_??? */", errstr); k_fspick(-1, efault, 0xf); -# ifndef PATH_TRACING +# ifndef PATH_TRACING printf("fspick(-1, %p, %s) = %s\n", efault, "FSPICK_CLOEXEC|FSPICK_SYMLINK_NOFOLLOW" "|FSPICK_NO_AUTOMOUNT|FSPICK_EMPTY_PATH", errstr); -# endif +# endif k_fspick(-1, empty, -1); -# ifndef PATH_TRACING +# ifndef PATH_TRACING printf("fspick(-1, \"\", %s|0xfffffff0) = %s\n", "FSPICK_CLOEXEC|FSPICK_SYMLINK_NOFOLLOW" "|FSPICK_NO_AUTOMOUNT|FSPICK_EMPTY_PATH", errstr); -# endif +# endif if (k_fspick(-1, path, 0) < 0) printf("fspick(-1, \"%s\", 0) = %s\n", diff --git a/tests/inotify_init.c b/tests/inotify_init.c index 363811cc..7b5e74af 100644 --- a/tests/inotify_init.c +++ b/tests/inotify_init.c @@ -19,23 +19,23 @@ int main(void) { -#ifdef PRINT_PATHS +# ifdef PRINT_PATHS skip_if_unavailable("/proc/self/fd/"); -#endif +# endif long rc = syscall(__NR_inotify_init, 42); -#ifdef PRINT_PATHS +# ifdef PRINT_PATHS if (rc < 0) perror_msg_and_skip("inotify_init"); -#endif +# endif printf("inotify_init() = " -#ifdef PRINT_PATHS +# ifdef PRINT_PATHS "%ld\n", rc -#else +# else "%s\n", sprintrc(rc) -#endif +# endif ); puts("+++ exited with 0 +++"); diff --git a/tests/inotify_init1.c b/tests/inotify_init1.c index 2408b647..17e2f4ba 100644 --- a/tests/inotify_init1.c +++ b/tests/inotify_init1.c @@ -25,18 +25,18 @@ # endif # define all_flags (O_NONBLOCK | cloexec_flag) -#ifdef PRINT_PATHS -# define RC_FMT "%ld<%s>" -#else -# define RC_FMT "%s" -#endif +# ifdef PRINT_PATHS +# define RC_FMT "%ld<%s>" +# else +# define RC_FMT "%s" +# endif int main(void) { -#ifdef PRINT_PATHS +# ifdef PRINT_PATHS skip_if_unavailable("/proc/self/fd/"); -#endif +# endif static const kernel_ulong_t bogus_flags1 = (kernel_ulong_t) 0xfacefeeddeadbeefULL | O_NONBLOCK; @@ -57,7 +57,7 @@ main(void) rc = syscall(__NR_inotify_init1, all_flags); -#ifdef PRINT_PATHS +# ifdef PRINT_PATHS if (rc < 0) perror_msg_and_skip("inotify_init(%#x)", all_flags); @@ -91,15 +91,15 @@ main(void) error_msg_and_fail("Unexpected first char '%c' of inotify fd " "link path", buf[0]); } -#endif +# endif printf("inotify_init1(IN_NONBLOCK%s) = " RC_FMT "\n", all_flags & cloexec_flag ? "|IN_CLOEXEC" : "", -#ifdef PRINT_PATHS +# ifdef PRINT_PATHS rc, inotify_path -#else +# else sprintrc(rc) -#endif +# endif ); puts("+++ exited with 0 +++");