-
PREFIX?=/usr/local
PKG_CONFIG?=pkg-config
INSTALL=install
PYTEST=pytest-3
CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall \
-Wno-pointer-sign \
- -Wno-zero-length-bounds \
- -Wno-stringop-overflow \
-fno-strict-aliasing \
-fno-delete-null-pointer-checks \
-I. -Iinclude -Iraid \
CC_VERSION=$(shell $(CC) -v 2>&1|grep -E '(gcc|clang) 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
ifneq (,$(findstring clang,$(CC_VERSION)))
- CFLAGS+=-Wno-missing-braces
+ CFLAGS+=-Wno-missing-braces \
+ -Wno-zero-length-array \
+ -Wno-shift-overflow \
+ -Wno-enum-conversion
endif
ifdef D
return opts;
}
+#define newline(c) \
+ do { \
+ printf("\n"); \
+ c = 0; \
+ } while(0)
void bch2_opts_usage(unsigned opt_types)
{
const struct bch_option *opt;
unsigned i, c = 0, helpcol = 30;
- void tabalign() {
- while (c < helpcol) {
- putchar(' ');
- c++;
- }
- }
- void newline() {
- printf("\n");
- c = 0;
- }
for (opt = bch2_opt_table;
opt < bch2_opt_table + bch2_opts_nr;
const char *l = opt->help;
if (c >= helpcol)
- newline();
+ newline(c);
while (1) {
const char *n = strchrnul(l, '\n');
- tabalign();
+ while (c < helpcol) {
+ putchar(' ');
+ c++;
+ }
printf("%.*s", (int) (n - l), l);
- newline();
+ newline(c);
if (!*n)
break;
l = n + 1;
}
} else {
- newline();
+ newline(c);
}
}
}