clang-format 16->17

This commit is contained in:
vanhauser-thc
2023-11-06 10:13:59 +01:00
parent 053334f35d
commit f3d2127fd8
13 changed files with 65 additions and 65 deletions

View File

@ -24,7 +24,7 @@ import importlib.metadata
# string_re = re.compile('(\\"(\\\\.|[^"\\\\])*\\")') # TODO: for future use # string_re = re.compile('(\\"(\\\\.|[^"\\\\])*\\")') # TODO: for future use
CURRENT_LLVM = os.getenv('LLVM_VERSION', 16) CURRENT_LLVM = os.getenv('LLVM_VERSION', 17)
CLANG_FORMAT_BIN = os.getenv("CLANG_FORMAT_BIN", "") CLANG_FORMAT_BIN = os.getenv("CLANG_FORMAT_BIN", "")

View File

@ -49,10 +49,10 @@ extern void __libc_init(void *raw_args, void (*onexit)(void) __unused,
int (*slingshot)(int, char **, char **), int (*slingshot)(int, char **, char **),
structors_array_t const *const structors); structors_array_t const *const structors);
#else #else
extern int __libc_start_main(int (*main)(int, char **, char **), int argc, extern int __libc_start_main(int (*main)(int, char **, char **), int argc,
char **ubp_av, void (*init)(void), char **ubp_av, void (*init)(void),
void (*fini)(void), void (*rtld_fini)(void), void (*fini)(void), void (*rtld_fini)(void),
void(*stack_end)); void(*stack_end));
#endif #endif
typedef int (*main_fn_t)(int argc, char **argv, char **envp); typedef int (*main_fn_t)(int argc, char **argv, char **envp);

View File

@ -1854,7 +1854,7 @@ inline u32 afl_mutate(afl_state_t *afl, u8 *buf, u32 len, u32 steps,
for (u32 step = 0; step < steps; ++step) { for (u32 step = 0; step < steps; ++step) {
retry_havoc_step : { retry_havoc_step: {
u32 r = rand_below(afl, MUT_STRATEGY_ARRAY_SIZE), item; u32 r = rand_below(afl, MUT_STRATEGY_ARRAY_SIZE), item;

View File

@ -365,7 +365,7 @@ typedef uint32_t XXH32_hash_t;
(defined(__cplusplus) || \ (defined(__cplusplus) || \
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)) (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */))
#include <stdint.h> #include <stdint.h>
typedef uint32_t XXH32_hash_t; typedef uint32_t XXH32_hash_t;
#else #else
#include <limits.h> #include <limits.h>
@ -1082,7 +1082,7 @@ struct XXH64_state_s {
#include <stdalign.h> #include <stdalign.h>
#define XXH_ALIGN(n) alignas(n) #define XXH_ALIGN(n) alignas(n)
#elif defined(__cplusplus) && (__cplusplus >= 201103L) /* >= C++11 */ #elif defined(__cplusplus) && (__cplusplus >= 201103L) /* >= C++11 */
/* In C++ alignas() is a keyword */ /* In C++ alignas() is a keyword */
#define XXH_ALIGN(n) alignas(n) #define XXH_ALIGN(n) alignas(n)
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define XXH_ALIGN(n) __attribute__((aligned(n))) #define XXH_ALIGN(n) __attribute__((aligned(n)))
@ -3031,8 +3031,8 @@ XXH64_hashFromCanonical(const XXH64_canonical_t *src) {
__STDC_VERSION__ >= 199901L /* >= C99 */ __STDC_VERSION__ >= 199901L /* >= C99 */
#define XXH_RESTRICT restrict #define XXH_RESTRICT restrict
#else #else
/* Note: it might be useful to define __restrict or __restrict__ for /* Note: it might be useful to define __restrict or __restrict__ for
* some C++ compilers */ * some C++ compilers */
#define XXH_RESTRICT /* disable */ #define XXH_RESTRICT /* disable */
#endif #endif
@ -3492,8 +3492,8 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) {
#define XXH_vec_mulo vec_mulo #define XXH_vec_mulo vec_mulo
#define XXH_vec_mule vec_mule #define XXH_vec_mule vec_mule
#elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) #elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw)
/* Clang has a better way to control this, we can just use the builtin /* Clang has a better way to control this, we can just use the builtin
* which doesn't swap. */ * which doesn't swap. */
#define XXH_vec_mulo __builtin_altivec_vmulouw #define XXH_vec_mulo __builtin_altivec_vmulouw
#define XXH_vec_mule __builtin_altivec_vmuleuw #define XXH_vec_mule __builtin_altivec_vmuleuw
#else #else
@ -3604,15 +3604,15 @@ XXH_FORCE_INLINE xxh_u64 XXH_mult32to64(xxh_u64 x, xxh_u64 y) {
#include <intrin.h> #include <intrin.h>
#define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) #define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y))
#else #else
/* /*
* Downcast + upcast is usually better than masking on older compilers * Downcast + upcast is usually better than masking on older compilers
* like GCC 4.2 (especially 32-bit ones), all without affecting newer * like GCC 4.2 (especially 32-bit ones), all without affecting newer
* compilers. * compilers.
* *
* The other method, (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF), will AND both * The other method, (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF), will AND both
* operands and perform a full 64x64 multiply -- entirely redundant on * operands and perform a full 64x64 multiply -- entirely redundant on
* 32-bit. * 32-bit.
*/ */
#define XXH_mult32to64(x, y) \ #define XXH_mult32to64(x, y) \
((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y)) ((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y))
#endif #endif

View File

@ -90,7 +90,7 @@ class CmpLogInstructions : public ModulePass {
#if LLVM_MAJOR >= 11 /* use new pass manager */ #if LLVM_MAJOR >= 11 /* use new pass manager */
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
#else #else
bool runOnModule(Module &M) override; bool runOnModule(Module &M) override;
#if LLVM_VERSION_MAJOR >= 4 #if LLVM_VERSION_MAJOR >= 4
StringRef getPassName() const override { StringRef getPassName() const override {

View File

@ -85,7 +85,7 @@ class CmpLogRoutines : public ModulePass {
#if LLVM_VERSION_MAJOR >= 11 /* use new pass manager */ #if LLVM_VERSION_MAJOR >= 11 /* use new pass manager */
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
#else #else
bool runOnModule(Module &M) override; bool runOnModule(Module &M) override;
#if LLVM_VERSION_MAJOR >= 4 #if LLVM_VERSION_MAJOR >= 4
StringRef getPassName() const override { StringRef getPassName() const override {

View File

@ -85,7 +85,7 @@ class CmplogSwitches : public ModulePass {
#if LLVM_VERSION_MAJOR >= 11 /* use new pass manager */ #if LLVM_VERSION_MAJOR >= 11 /* use new pass manager */
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
#else #else
bool runOnModule(Module &M) override; bool runOnModule(Module &M) override;
#if LLVM_VERSION_MAJOR < 4 #if LLVM_VERSION_MAJOR < 4
const char *getPassName() const override { const char *getPassName() const override {

View File

@ -84,7 +84,7 @@ class SplitSwitchesTransform : public ModulePass {
#if LLVM_VERSION_MAJOR >= 11 /* use new pass manager */ #if LLVM_VERSION_MAJOR >= 11 /* use new pass manager */
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM); PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
#else #else
bool runOnModule(Module &M) override; bool runOnModule(Module &M) override;
#if LLVM_VERSION_MAJOR >= 4 #if LLVM_VERSION_MAJOR >= 4
StringRef getPassName() const override { StringRef getPassName() const override {

View File

@ -771,8 +771,8 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
#include "/usr/include/malloc.h" #include "/usr/include/malloc.h"
#else /* HAVE_USR_INCLUDE_MALLOC_H */ #else /* HAVE_USR_INCLUDE_MALLOC_H */
#ifndef STRUCT_MALLINFO_DECLARED #ifndef STRUCT_MALLINFO_DECLARED
/* HP-UX (and others?) redefines mallinfo unless _STRUCT_MALLINFO is /* HP-UX (and others?) redefines mallinfo unless _STRUCT_MALLINFO is
* defined */ * defined */
#define _STRUCT_MALLINFO #define _STRUCT_MALLINFO
#define STRUCT_MALLINFO_DECLARED 1 #define STRUCT_MALLINFO_DECLARED 1
struct mallinfo { struct mallinfo {
@ -1660,10 +1660,10 @@ extern size_t getpagesize();
#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) #define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
/* the number of bytes to offset an address to align it */ /* the number of bytes to offset an address to align it */
#define align_offset(A) \ #define align_offset(A) \
((((size_t)(A)&CHUNK_ALIGN_MASK) == 0) \ ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0) \
? 0 \ ? 0 \
: ((MALLOC_ALIGNMENT - ((size_t)(A)&CHUNK_ALIGN_MASK)) & \ : ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & \
CHUNK_ALIGN_MASK)) CHUNK_ALIGN_MASK))
/* -------------------------- MMAP preliminaries ------------------------- */ /* -------------------------- MMAP preliminaries ------------------------- */
@ -1715,10 +1715,10 @@ static FORCEINLINE int unixmunmap(void *ptr, size_t size) {
#define MUNMAP_DEFAULT(a, s) unixmunmap((a), (s)) #define MUNMAP_DEFAULT(a, s) unixmunmap((a), (s))
#else /* MAP_ANONYMOUS */ #else /* MAP_ANONYMOUS */
/* /*
Nearly all versions of mmap support MAP_ANONYMOUS, so the following Nearly all versions of mmap support MAP_ANONYMOUS, so the following
is unlikely to be needed, but is supplied just in case. is unlikely to be needed, but is supplied just in case.
*/ */
#define MMAP_FLAGS (MAP_PRIVATE) #define MMAP_FLAGS (MAP_PRIVATE)
static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
#define MMAP_DEFAULT(s) \ #define MMAP_DEFAULT(s) \
@ -1965,7 +1965,7 @@ static FORCEINLINE void x86_clear_lock(int *sl) {
#endif /* ... gcc spins locks ... */ #endif /* ... gcc spins locks ... */
/* How to yield for a spin lock */ /* How to yield for a spin lock */
#define SPINS_PER_YIELD 63 #define SPINS_PER_YIELD 63
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define SLEEP_EX_DURATION 50 /* delay for yield/sleep */ #define SLEEP_EX_DURATION 50 /* delay for yield/sleep */
@ -2008,11 +2008,11 @@ static MLOCK_T malloc_global_mutex = 0;
#define CURRENT_THREAD GetCurrentThreadId() #define CURRENT_THREAD GetCurrentThreadId()
#define EQ_OWNER(X, Y) ((X) == (Y)) #define EQ_OWNER(X, Y) ((X) == (Y))
#else #else
/* /*
Note: the following assume that pthread_t is a type that can be Note: the following assume that pthread_t is a type that can be
initialized to (casted) zero. If this is not the case, you will need initialized to (casted) zero. If this is not the case, you will need
to somehow redefine these or not use spin locks. to somehow redefine these or not use spin locks.
*/ */
#define THREAD_ID_T pthread_t #define THREAD_ID_T pthread_t
#define CURRENT_THREAD pthread_self() #define CURRENT_THREAD pthread_self()
#define EQ_OWNER(X, Y) pthread_equal(X, Y) #define EQ_OWNER(X, Y) pthread_equal(X, Y)
@ -2169,7 +2169,7 @@ static int pthread_init_lock(MLOCK_T *lk) {
#endif /* ... lock types ... */ #endif /* ... lock types ... */
/* Common code for all lock types */ /* Common code for all lock types */
#define USE_LOCK_BIT (2U) #define USE_LOCK_BIT (2U)
#ifndef ACQUIRE_MALLOC_GLOBAL_LOCK #ifndef ACQUIRE_MALLOC_GLOBAL_LOCK
@ -3077,7 +3077,7 @@ static size_t traverse_and_check(mstate m);
/* The size of the smallest chunk held in bin with index i */ /* The size of the smallest chunk held in bin with index i */
#define minsize_for_tree_index(i) \ #define minsize_for_tree_index(i) \
((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \
(((size_t)((i)&SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
/* ------------------------ Operations on bin maps ----------------------- */ /* ------------------------ Operations on bin maps ----------------------- */
@ -3245,7 +3245,7 @@ static size_t traverse_and_check(mstate m);
#else /* FOOTERS */ #else /* FOOTERS */
/* Set foot of inuse chunk to be xor of mstate and seed */ /* Set foot of inuse chunk to be xor of mstate and seed */
#define mark_inuse_foot(M, p, s) \ #define mark_inuse_foot(M, p, s) \
(((mchunkptr)((char *)(p) + (s)))->prev_foot = \ (((mchunkptr)((char *)(p) + (s)))->prev_foot = \
((size_t)(M) ^ mparams.magic)) ((size_t)(M) ^ mparams.magic))

View File

@ -80,8 +80,8 @@ static unsigned char __tmp_alloc_zone[TMP_ZONE_SIZE];
#else #else
// From dlmalloc.c // From dlmalloc.c
void *dlmalloc(size_t); void *dlmalloc(size_t);
void dlfree(void *); void dlfree(void *);
#define backend_malloc dlmalloc #define backend_malloc dlmalloc
#define backend_free dlfree #define backend_free dlfree

View File

@ -577,13 +577,13 @@ u8 fuzz_one_original(afl_state_t *afl) {
* SIMPLE BITFLIP (+dictionary construction) * * SIMPLE BITFLIP (+dictionary construction) *
*********************************************/ *********************************************/
#define FLIP_BIT(_ar, _b) \ #define FLIP_BIT(_ar, _b) \
do { \ do { \
\ \
u8 *_arf = (u8 *)(_ar); \ u8 *_arf = (u8 *)(_ar); \
u32 _bf = (_b); \ u32 _bf = (_b); \
_arf[(_bf) >> 3] ^= (128 >> ((_bf)&7)); \ _arf[(_bf) >> 3] ^= (128 >> ((_bf) & 7)); \
\ \
} while (0) } while (0)
/* Single walking bit. */ /* Single walking bit. */
@ -2216,7 +2216,7 @@ havoc_stage:
} }
retry_havoc_step : { retry_havoc_step: {
u32 r = rand_below(afl, rand_max), item; u32 r = rand_below(afl, rand_max), item;
@ -3703,13 +3703,13 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
* SIMPLE BITFLIP (+dictionary construction) * * SIMPLE BITFLIP (+dictionary construction) *
*********************************************/ *********************************************/
#define FLIP_BIT(_ar, _b) \ #define FLIP_BIT(_ar, _b) \
do { \ do { \
\ \
u8 *_arf = (u8 *)(_ar); \ u8 *_arf = (u8 *)(_ar); \
u32 _bf = (_b); \ u32 _bf = (_b); \
_arf[(_bf) >> 3] ^= (128 >> ((_bf)&7)); \ _arf[(_bf) >> 3] ^= (128 >> ((_bf) & 7)); \
\ \
} while (0) } while (0)
/* Single walking bit. */ /* Single walking bit. */

View File

@ -1828,7 +1828,7 @@ static void try_to_add_to_dictN(afl_state_t *afl, u128 v, u8 size) {
for (k = 0; k < size; ++k) { for (k = 0; k < size; ++k) {
#else #else
u32 off = 16 - size; u32 off = 16 - size;
for (k = 16 - size; k < 16; ++k) { for (k = 16 - size; k < 16; ++k) {
#endif #endif

View File

@ -55,7 +55,7 @@
#elif defined __HAIKU__ #elif defined __HAIKU__
#include <kernel/image.h> #include <kernel/image.h>
#elif defined __sun #elif defined __sun
/* For map addresses the old struct is enough */ /* For map addresses the old struct is enough */
#include <sys/procfs.h> #include <sys/procfs.h>
#include <limits.h> #include <limits.h>
#endif #endif
@ -168,7 +168,7 @@ static void __tokencap_load_mappings(void) {
#elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ #elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
#if defined __FreeBSD__ #if defined __FreeBSD__
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid}; int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid};
#elif defined __OpenBSD__ #elif defined __OpenBSD__
int mib[] = {CTL_KERN, KERN_PROC_VMMAP, __tokencap_pid}; int mib[] = {CTL_KERN, KERN_PROC_VMMAP, __tokencap_pid};
#elif defined __NetBSD__ #elif defined __NetBSD__
@ -209,7 +209,7 @@ static void __tokencap_load_mappings(void) {
#if defined __FreeBSD__ || defined __NetBSD__ #if defined __FreeBSD__ || defined __NetBSD__
#if defined __FreeBSD__ #if defined __FreeBSD__
size_t size = region->kve_structsize; size_t size = region->kve_structsize;
if (size == 0) break; if (size == 0) break;
#elif defined __NetBSD__ #elif defined __NetBSD__