diff options
author | Dmitry V. Levin <ldv@strace.io> | 2021-12-01 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-12-01 08:00:00 +0000 |
commit | 17120d78150939170680ebf2d141d24a9d5b20ff (patch) | |
tree | 0787dd12606c8e90d82d4a9d8d61a6c76519669d | |
parent | d9763dca42b045328b2481fe793b7b5389430e29 (diff) | |
download | strace-17120d78150939170680ebf2d141d24a9d5b20ff.tar.gz |
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:]]' src tests |grep -v '\.sh$') |while read f; do
cppi < "$f" > "$f".cppi; mv "$f".cppi "$f"
done
-rw-r--r-- | src/macros.h | 20 | ||||
-rw-r--r-- | tests/nlattr_ifla_af_inet6.h | 4 | ||||
-rw-r--r-- | tests/openat2.c | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/macros.h b/src/macros.h index aa9e46fdb..e0d3b59b8 100644 --- a/src/macros.h +++ b/src/macros.h @@ -115,18 +115,18 @@ is_filled(const char *ptr, char fill, size_t size) * @param type_ Type whose size is to be checked. * @param sz_ Expected type size in bytes. */ -#define CHECK_TYPE_SIZE(type_, sz_) \ +# define CHECK_TYPE_SIZE(type_, sz_) \ static_assert(sizeof(type_) == (sz_), \ "Unexpected size of " #type_ "(" #sz_ " expected)") -#ifdef WORDS_BIGENDIAN -# define BE16(val_) val_ -# define BE32(val_) val_ -# define BE64(val_) val_ -#else -# define BE16(val_) ((((val_) & 0xff) << 8) | (((val_) >> 8) & 0xff)) -# define BE32(val_) ((BE16(val_) << 16) | BE16((val_) >> 16)) -# define BE64(val_) ((BE32(val_) << 32) | BE32((val_) >> 32)) -#endif +# ifdef WORDS_BIGENDIAN +# define BE16(val_) val_ +# define BE32(val_) val_ +# define BE64(val_) val_ +# else +# define BE16(val_) ((((val_) & 0xff) << 8) | (((val_) >> 8) & 0xff)) +# define BE32(val_) ((BE16(val_) << 16) | BE16((val_) >> 16)) +# define BE64(val_) ((BE32(val_) << 32) | BE32((val_) >> 32)) +# endif #endif /* !STRACE_MACROS_H */ diff --git a/tests/nlattr_ifla_af_inet6.h b/tests/nlattr_ifla_af_inet6.h index 5b996812b..9df320f1b 100644 --- a/tests/nlattr_ifla_af_inet6.h +++ b/tests/nlattr_ifla_af_inet6.h @@ -8,9 +8,9 @@ */ #ifndef STRACE_TESTS_NLATTR_IFLA_AF_INET6 -#define STRACE_TESTS_NLATTR_IFLA_AF_INET6 +# define STRACE_TESTS_NLATTR_IFLA_AF_INET6 -#include "tests.h" +# include "tests.h" static void print_arr_val(uint32_t *val, size_t idx, const char *idx_str) diff --git a/tests/openat2.c b/tests/openat2.c index beae992ce..521692a53 100644 --- a/tests/openat2.c +++ b/tests/openat2.c @@ -45,9 +45,9 @@ main(void) { SKIP_IF_PROC_IS_UNAVAILABLE; -# ifdef YFLAG +#ifdef YFLAG char *cwd = get_fd_path(get_dir_fd(".")); -# endif +#endif long rc; const char *rcstr; struct open_how *how = tail_alloc(sizeof(*how)); |