mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
minor fixes for clang support
This commit is contained in:
parent
2e2d5a3f7e
commit
9c0dc7b8d4
12
Makefile
12
Makefile
@ -1,12 +1,9 @@
|
|||||||
|
|
||||||
PREFIX?=/usr/local
|
PREFIX?=/usr/local
|
||||||
PKG_CONFIG?=pkg-config
|
PKG_CONFIG?=pkg-config
|
||||||
INSTALL=install
|
INSTALL=install
|
||||||
PYTEST=pytest-3
|
PYTEST=pytest-3
|
||||||
CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall \
|
CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall \
|
||||||
-Wno-pointer-sign \
|
-Wno-pointer-sign \
|
||||||
-Wno-zero-length-bounds \
|
|
||||||
-Wno-stringop-overflow \
|
|
||||||
-fno-strict-aliasing \
|
-fno-strict-aliasing \
|
||||||
-fno-delete-null-pointer-checks \
|
-fno-delete-null-pointer-checks \
|
||||||
-I. -Iinclude -Iraid \
|
-I. -Iinclude -Iraid \
|
||||||
@ -28,11 +25,16 @@ VERSION?=$(shell git describe --dirty=+ 2>/dev/null || echo v0.1-nogit)
|
|||||||
CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
|
CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) version')
|
||||||
|
|
||||||
ifneq (,$(findstring gcc,$(CC_VERSION)))
|
ifneq (,$(findstring gcc,$(CC_VERSION)))
|
||||||
CFLAGS+=-Wno-unused-but-set-variable
|
CFLAGS+=-Wno-unused-but-set-variable \
|
||||||
|
-Wno-zero-length-bounds \
|
||||||
|
-Wno-stringop-overflow
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(findstring clang,$(CC_VERSION)))
|
ifneq (,$(findstring clang,$(CC_VERSION)))
|
||||||
CFLAGS+=-Wno-missing-braces
|
CFLAGS+=-Wno-missing-braces \
|
||||||
|
-Wno-zero-length-array \
|
||||||
|
-Wno-shift-overflow \
|
||||||
|
-Wno-enum-conversion
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef D
|
ifdef D
|
||||||
|
@ -1100,22 +1100,17 @@ struct bch_opts bch2_parse_opts(struct bch_opt_strs strs)
|
|||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define newline(c) \
|
||||||
|
do { \
|
||||||
|
printf("\n"); \
|
||||||
|
c = 0; \
|
||||||
|
} while(0)
|
||||||
void bch2_opts_usage(unsigned opt_types)
|
void bch2_opts_usage(unsigned opt_types)
|
||||||
{
|
{
|
||||||
const struct bch_option *opt;
|
const struct bch_option *opt;
|
||||||
unsigned i, c = 0, helpcol = 30;
|
unsigned i, c = 0, helpcol = 30;
|
||||||
|
|
||||||
void tabalign() {
|
|
||||||
while (c < helpcol) {
|
|
||||||
putchar(' ');
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void newline() {
|
|
||||||
printf("\n");
|
|
||||||
c = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (opt = bch2_opt_table;
|
for (opt = bch2_opt_table;
|
||||||
opt < bch2_opt_table + bch2_opts_nr;
|
opt < bch2_opt_table + bch2_opts_nr;
|
||||||
@ -1146,21 +1141,24 @@ void bch2_opts_usage(unsigned opt_types)
|
|||||||
const char *l = opt->help;
|
const char *l = opt->help;
|
||||||
|
|
||||||
if (c >= helpcol)
|
if (c >= helpcol)
|
||||||
newline();
|
newline(c);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
const char *n = strchrnul(l, '\n');
|
const char *n = strchrnul(l, '\n');
|
||||||
|
|
||||||
tabalign();
|
while (c < helpcol) {
|
||||||
|
putchar(' ');
|
||||||
|
c++;
|
||||||
|
}
|
||||||
printf("%.*s", (int) (n - l), l);
|
printf("%.*s", (int) (n - l), l);
|
||||||
newline();
|
newline(c);
|
||||||
|
|
||||||
if (!*n)
|
if (!*n)
|
||||||
break;
|
break;
|
||||||
l = n + 1;
|
l = n + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newline();
|
newline(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
PYTEST=pytest-3
|
||||||
spam=$(tempfile)
|
spam=$(tempfile)
|
||||||
unset BCACHEFS_FUSE BCACHEFS_TEST_USE_VALGRIND D
|
unset BCACHEFS_FUSE BCACHEFS_TEST_USE_VALGRIND D
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ function test() {
|
|||||||
echo Running tests.
|
echo Running tests.
|
||||||
(
|
(
|
||||||
cd tests
|
cd tests
|
||||||
pytest-3 -n${JOBS}
|
${PYTEST} -n${JOBS}
|
||||||
) > ${spam} 2>&1
|
) > ${spam} 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ function test_vg() {
|
|||||||
(
|
(
|
||||||
export BCACHEFS_TEST_USE_VALGRIND=yes
|
export BCACHEFS_TEST_USE_VALGRIND=yes
|
||||||
cd tests
|
cd tests
|
||||||
pytest-3 -n${JOBS}
|
${PYTEST} -n${JOBS}
|
||||||
) > ${spam} 2>&1
|
) > ${spam} 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user