From: Dmitry V. Levin Date: Tue, 24 Sep 2019 21:35:26 +0000 (+0000) Subject: Fix preprocessor indentation X-Git-Tag: v5.3~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89341445ad72d8fb40564fd87eb5d6cbc5aceaae;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 119ed515..06bf1248 100644 --- a/defs.h +++ b/defs.h @@ -819,9 +819,9 @@ extern const char *sprinttime(long long sec); extern const char *sprinttime_nsec(long long sec, unsigned long long nsec); extern const char *sprinttime_usec(long long sec, unsigned long long usec); -#ifndef MAX_ADDR_LEN -# define MAX_ADDR_LEN 32 -#endif +# ifndef MAX_ADDR_LEN +# define MAX_ADDR_LEN 32 +# endif extern const char *sprint_mac_addr(const uint8_t addr[], size_t size); extern void print_mac_addr(const char *prefix, diff --git a/print_fields.h b/print_fields.h index eda16f67..ce165ec5 100644 --- a/print_fields.h +++ b/print_fields.h @@ -79,14 +79,14 @@ (xlat_), NULL); \ } while (0) -#define PRINT_FIELD_ERR_D(prefix_, where_, field_) \ +# define PRINT_FIELD_ERR_D(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_err(sign_extend_unsigned_to_ll((where_).field_), \ true); \ } while (0) -#define PRINT_FIELD_ERR_U(prefix_, where_, field_) \ +# define PRINT_FIELD_ERR_U(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ print_err(zero_extend_signed_to_ull((where_).field_), \ @@ -261,7 +261,7 @@ (size_)); \ } while (0) -#define PRINT_FIELD_HWADDR_SZ(prefix_, where_, field_, size_, hwtype_) \ +# define PRINT_FIELD_HWADDR_SZ(prefix_, where_, field_, size_, hwtype_) \ do { \ static_assert(sizeof(((where_).field_)[0]) == 1, \ "hwaddress is not a byte array"); \ diff --git a/tests/accept_compat.h b/tests/accept_compat.h index 9ce6f6c2..0462e54e 100644 --- a/tests/accept_compat.h +++ b/tests/accept_compat.h @@ -10,7 +10,7 @@ # include # include -#include "scno.h" +# include "scno.h" # if defined __NR_socketcall && defined __sparc__ /* diff --git a/tests/clone3.c b/tests/clone3.c index 8f9f5b1e..69030dbf 100644 --- a/tests/clone3.c +++ b/tests/clone3.c @@ -142,7 +142,7 @@ print_addr64(const char *pfx, uint64_t addr) static void print_tls(const char *pfx, uint64_t arg_ptr, enum validity_flags vf) { -# if defined HAVE_STRUCT_USER_DESC && defined __i386__ +#if defined HAVE_STRUCT_USER_DESC && defined __i386__ if (!(vf & TLS_VALID)) { print_addr64(pfx, arg_ptr); return; @@ -169,9 +169,9 @@ print_tls(const char *pfx, uint64_t arg_ptr, enum validity_flags vf) arg->limit_in_pages, arg->seg_not_present, arg->useable); -# else +#else print_addr64(pfx, arg_ptr); -# endif +#endif } static inline void @@ -278,13 +278,13 @@ main(int argc, char *argv[]) int *parent_tid = tail_alloc(sizeof(*parent_tid)); long rc; -# if defined HAVE_STRUCT_USER_DESC +#if defined HAVE_STRUCT_USER_DESC struct user_desc *tls = tail_alloc(sizeof(*tls)); fill_memory(tls, sizeof(*tls)); -# else +#else int *tls = tail_alloc(sizeof(*tls)); -# endif +#endif *pidfd = 0xbadc0ded; *child_tid = 0xdeadface; diff --git a/tests/getgroups.c b/tests/getgroups.c index c5738a5d..221d5f3a 100644 --- a/tests/getgroups.c +++ b/tests/getgroups.c @@ -17,7 +17,7 @@ #else # include "tests.h" -#include "scno.h" +# include "scno.h" # ifdef __NR_getgroups diff --git a/tests/ioctl_perf.c b/tests/ioctl_perf.c index cd976baa..6a3513da 100644 --- a/tests/ioctl_perf.c +++ b/tests/ioctl_perf.c @@ -16,7 +16,7 @@ # include # include # include -#include "scno.h" +# include "scno.h" # include /* diff --git a/tests/setgroups.c b/tests/setgroups.c index 6045ef70..d60c86c1 100644 --- a/tests/setgroups.c +++ b/tests/setgroups.c @@ -17,7 +17,7 @@ #else # include "tests.h" -#include "scno.h" +# include "scno.h" # ifdef __NR_setgroups