aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-10 10:24:24 +0200
committervan Hauser <vh@thc.org>2020-05-10 10:24:24 +0200
commit2e553bcd69a6852e7feb7e87ce757babfcb26df0 (patch)
tree32685901018d74c8c1835d3d275d2cfb24e05dc0
parent0e5a5f18050d729bc79e4dd5203ca245aa532d85 (diff)
downloadafl++-2e553bcd69a6852e7feb7e87ce757babfcb26df0.tar.gz
code-format
-rw-r--r--include/types.h24
-rw-r--r--llvm_mode/LLVMInsTrim.so.cc3
-rw-r--r--llvm_mode/afl-clang-fast.c6
-rw-r--r--qemu_mode/patches/afl-qemu-cpu-inl.h2
-rw-r--r--src/afl-showmap.c3
5 files changed, 21 insertions, 17 deletions
diff --git a/include/types.h b/include/types.h
index 647044c4..f89221cd 100644
--- a/include/types.h
+++ b/include/types.h
@@ -154,19 +154,19 @@ typedef int64_t s64;
#define MEM_BARRIER() __asm__ volatile("" ::: "memory")
#if __GNUC__ < 6
-# ifndef likely
-# define likely(_x) (_x)
-# endif
-# ifndef unlikely
-# define unlikely(_x) (_x)
-# endif
+#ifndef likely
+#define likely(_x) (_x)
+#endif
+#ifndef unlikely
+#define unlikely(_x) (_x)
+#endif
#else
-# ifndef likely
-# define likely(_x) __builtin_expect(!!(_x), 1)
-# endif
-# ifndef unlikely
-# define unlikely(_x) __builtin_expect(!!(_x), 0)
-# endif
+#ifndef likely
+#define likely(_x) __builtin_expect(!!(_x), 1)
+#endif
+#ifndef unlikely
+#define unlikely(_x) __builtin_expect(!!(_x), 0)
+#endif
#endif
#endif /* ! _HAVE_TYPES_H */
diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc
index 41d4397b..69fc079b 100644
--- a/llvm_mode/LLVMInsTrim.so.cc
+++ b/llvm_mode/LLVMInsTrim.so.cc
@@ -143,7 +143,7 @@ struct InsTrim : public ModulePass {
char *ctx_str = getenv("AFL_LLVM_CTX");
#ifdef AFL_HAVE_VECTOR_INTRINSICS
- int ngram_size = 0;
+ int ngram_size = 0;
/* Decide previous location vector size (must be a power of two) */
VectorType *PrevLocTy;
@@ -359,6 +359,7 @@ struct InsTrim : public ModulePass {
MDNode::get(C, None));
} else
+
#endif
{
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index 027f4035..07754d1d 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -337,16 +337,18 @@ static void edit_params(u32 argc, char **argv, char **envp) {
// e.g. compiled download or compiled from github then it's ./lib directory
// might not be in the search path. Add it if so.
u8 *libdir = strdup(LLVM_LIBDIR);
- if (strlen(libdir) && strncmp(libdir, "/usr", 4) &&
+ if (cpp_mode && strlen(libdir) && strncmp(libdir, "/usr", 4) &&
strncmp(libdir, "/lib", 4)) {
cc_params[cc_par_cnt++] = "-rpath";
cc_params[cc_par_cnt++] = libdir;
- } else
+ } else {
free(libdir);
+ }
+
/* Detect stray -v calls from ./configure scripts. */
while (--argc) {
diff --git a/qemu_mode/patches/afl-qemu-cpu-inl.h b/qemu_mode/patches/afl-qemu-cpu-inl.h
index a6136722..78a8f800 100644
--- a/qemu_mode/patches/afl-qemu-cpu-inl.h
+++ b/qemu_mode/patches/afl-qemu-cpu-inl.h
@@ -127,7 +127,7 @@ static inline TranslationBlock *tb_find(CPUState *, TranslationBlock *, int,
uint32_t);
static inline void tb_add_jump(TranslationBlock *tb, int n,
TranslationBlock *tb_next);
-int open_self_maps(void *cpu_env, int fd);
+int open_self_maps(void *cpu_env, int fd);
/*************************
* ACTUAL IMPLEMENTATION *
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 784d323d..ed59f2f5 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -865,7 +865,8 @@ int main(int argc, char **argv_orig, char **envp) {
}
- stdin_file = alloc_printf("%s/.afl-showmap-temp-%u", use_dir, (u32)getpid());
+ stdin_file =
+ alloc_printf("%s/.afl-showmap-temp-%u", use_dir, (u32)getpid());
unlink(stdin_file);
atexit(at_exit_handler);
fsrv->out_fd = open(stdin_file, O_RDWR | O_CREAT | O_EXCL, 0600);