From b096078c282af7233062ba242a213e6f5574cfb1 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 23 May 2022 20:40:53 +0300 Subject: switch from clang-format to uncrustify The output is close enough, and I like that uncrustify is a third-party tool, so people can install a single tool for formatting instead of having to lug around a whole toolchain. I fully expect to have to add settings to uncrustify.conf, but let's see how this goes. --- include/apos/atomic.h | 3 ++- include/apos/mem.h | 14 +++++++++----- include/apos/utils.h | 8 ++++---- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'include/apos') diff --git a/include/apos/atomic.h b/include/apos/atomic.h index 4026b1f..a4292d6 100644 --- a/include/apos/atomic.h +++ b/include/apos/atomic.h @@ -113,7 +113,8 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; #define atomic_load_explicit(obj, mode) N_ATOMIC(load)(obj, mode) -#define atomic_load(obj) atomic_load_explicit(obj, ATOMIC_SEQ_CST) +#define atomic_load(obj) atomic_load_explicit(obj, \ + ATOMIC_SEQ_CST) #define atomic_exchange_explicit(obj, val, mode) \ N_ATOMIC(exchange)(obj, val, mode) diff --git a/include/apos/mem.h b/include/apos/mem.h index bbe7532..7d24e0e 100644 --- a/include/apos/mem.h +++ b/include/apos/mem.h @@ -13,14 +13,16 @@ #define pnum_to_index(pnum, order) \ (((pnum) >> __o_offset(order)) & (__o_width(order) - 1)) -#define pm_to_index(paddr, order) (pnum_to_index(pm_to_pnum(paddr), (order))) +#define pm_to_index(paddr, \ + order) (pnum_to_index(pm_to_pnum(paddr), (order))) #define pm_to_pnum(paddr) ((paddr) >> __mm_page_shift) #define pnum_to_paddr(pnum) ((pnum) << __mm_page_shift) #define move_forward(var, num) (((var) += (num)) - (num)) #define move_paddr(paddr, base, offset) ((((pm_t)(paddr)) - (base)) + (offset)) -#define num_elems(num) (((num) + MM_OINFO_WIDTH - 1) / MM_OINFO_WIDTH) +#define num_elems(num) (((num) + MM_OINFO_WIDTH - 1) / \ + MM_OINFO_WIDTH) #define num_indexes(num) ((num) / MM_OINFO_WIDTH) #define index_elems(num) ((num) / MM_OINFO_WIDTH) #define state_elems(num) (sizeof(mm_info_t) * (num_elems(num))) @@ -35,13 +37,15 @@ #define __o_container(idx) ((idx) / MM_OINFO_WIDTH) #define __o_bit(idx) ((idx) & (MM_OINFO_WIDTH - 1)) -#define __va(x) (void *)(((uintptr_t)(x)) + VM_DMAP - RAM_BASE) -#define __pa(x) (void *)(((uintptr_t)(x)) - VM_DMAP + RAM_BASE) +#define __va(x) (void *)(((uintptr_t)(x)) + VM_DMAP - \ + RAM_BASE) +#define __pa(x) (void *)(((uintptr_t)(x)) - VM_DMAP + \ + RAM_BASE) #define __page(x) ((x) / BASE_PAGE_SIZE) #define __addr(x) ((x)*BASE_PAGE_SIZE) #define __pages(x) \ (is_aligned((x), BASE_PAGE_SIZE) ? __page((x)) : \ - __page((x) + BASE_PAGE_SIZE)) + __page((x) + BASE_PAGE_SIZE)) #define __bytes(x) (__addr(x)) /* if memory region is used or not */ diff --git a/include/apos/utils.h b/include/apos/utils.h index 1f1ade9..03bb801 100644 --- a/include/apos/utils.h +++ b/include/apos/utils.h @@ -20,7 +20,7 @@ (MIN3(a, b, c) <= MIN3(b, c, d) ? MIN3(a, b, c) : MIN3(b, c, d)) /* etc... */ -#define GLUE2(x, y) x ## y +#define GLUE2(x, y) x##y #define GLUE(x, y) GLUE2(x, y) #define QUOTE2(x) #x @@ -71,7 +71,7 @@ : align_up_ull)((x), (y)) #define DEFINE_ALIGN_UP(name, type) \ - static inline type align_up_ ## name(type val, type a) \ + static inline type align_up_##name(type val, type a) \ { \ if (!a) { \ return val; \ @@ -114,7 +114,7 @@ DEFINE_ALIGN_UP(ull, unsigned long long); : align_down_ull)((x), (y)) #define DEFINE_ALIGN_DOWN(name, type) \ - static inline type align_down_ ## name(type val, type a) \ + static inline type align_down_##name(type val, type a) \ { \ if (!a) { \ return val; \ @@ -151,7 +151,7 @@ DEFINE_ALIGN_DOWN(ull, unsigned long long); : is_aligned_ll)((x), (y)) #define DEFINE_ALIGNED(name, type) \ - static inline bool is_aligned_ ## name(type val, type a) \ + static inline bool is_aligned_##name(type val, type a) \ { \ if (!a) { \ return true; \ -- cgit v1.3