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