mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
Fix some clang warnings
the issue in cmd_debug - passing members of struct bpos to kstrtoull, which aren't aligned - was a legit bug
This commit is contained in:
parent
64c325ef48
commit
978c160405
18
Makefile
18
Makefile
@ -2,7 +2,6 @@
|
||||
PREFIX=/usr
|
||||
INSTALL=install
|
||||
CFLAGS+=-std=gnu99 -O2 -g -MMD -Wall \
|
||||
-Wno-unused-but-set-variable \
|
||||
-Wno-pointer-sign \
|
||||
-fno-strict-aliasing \
|
||||
-I. -Iinclude -Ilibbcachefs \
|
||||
@ -16,12 +15,23 @@ CFLAGS+=-std=gnu99 -O2 -g -MMD -Wall \
|
||||
$(EXTRA_CFLAGS)
|
||||
LDFLAGS+=-O2 -g
|
||||
|
||||
ifdef D
|
||||
CFLAGS+=-Werror
|
||||
else
|
||||
CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
|
||||
|
||||
ifneq (,$(findstring gcc,$(CC_VERSION)))
|
||||
CFLAGS+=-Wno-unused-but-set-variable
|
||||
ifndef D
|
||||
CFLAGS+=-flto
|
||||
LDFLAGS+=-flto
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring clang,$(CC_VERSION)))
|
||||
CFLAGS+=-Wno-missing-braces
|
||||
endif
|
||||
|
||||
ifdef D
|
||||
CFLAGS+=-Werror
|
||||
endif
|
||||
|
||||
PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib"
|
||||
CFLAGS+=`pkg-config --cflags ${PKGCONFIG_LIBS}`
|
||||
|
@ -192,14 +192,14 @@ static struct bpos parse_pos(char *buf)
|
||||
char *s = buf;
|
||||
char *inode = strsep(&s, ":");
|
||||
char *offset = strsep(&s, ":");
|
||||
struct bpos ret = { 0 };
|
||||
u64 inode_v, offset_v;
|
||||
|
||||
if (!inode || !offset || s ||
|
||||
kstrtoull(inode, 10, &ret.inode) ||
|
||||
kstrtoull(offset, 10, &ret.offset))
|
||||
kstrtoull(inode, 10, &inode_v) ||
|
||||
kstrtoull(offset, 10, &offset_v))
|
||||
die("invalid bpos %s", buf);
|
||||
|
||||
return ret;
|
||||
return (struct bpos) { .inode = inode_v, .offset = offset_v };
|
||||
}
|
||||
|
||||
static void list_keys_usage(void)
|
||||
|
6
cmd_fs.c
6
cmd_fs.c
@ -23,9 +23,10 @@ int cmd_fs_show(int argc, char *argv[])
|
||||
if (argc != 2)
|
||||
die("Please supply a filesystem");
|
||||
|
||||
#if 0
|
||||
struct bcache_handle fs = bcache_fs_open(argv[1]);
|
||||
#endif
|
||||
|
||||
fs = fs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -34,8 +35,9 @@ int cmd_fs_set(int argc, char *argv[])
|
||||
if (argc != 2)
|
||||
die("Please supply a filesystem");
|
||||
|
||||
#if 0
|
||||
struct bcache_handle fs = bcache_fs_open(argv[1]);
|
||||
#endif
|
||||
|
||||
fs = fs;
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/blk_types.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef u64 sector_t;
|
||||
typedef unsigned fmode_t;
|
||||
|
||||
struct bio;
|
||||
|
@ -22,10 +22,10 @@
|
||||
#define WARN(cond, ...) assert(!(cond))
|
||||
|
||||
#define WARN_ON(condition) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
int __ret_warn_on = unlikely(!!(condition)); \
|
||||
if (__ret_warn_on) \
|
||||
__WARN(); \
|
||||
unlikely(__ret_warn_on); \
|
||||
__ret_warn_on; \
|
||||
})
|
||||
|
||||
#endif /* __TOOLS_LINUX_BUG_H */
|
||||
|
@ -30,7 +30,7 @@ static inline void raw_spin_unlock(raw_spinlock_t *lock)
|
||||
|
||||
#define raw_spin_lock_irqsave(lock, flags) \
|
||||
do { \
|
||||
(void) flags; \
|
||||
flags = 0; \
|
||||
raw_spin_lock(lock); \
|
||||
} while (0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user