Merge branch 'js/comma-semicolon-confusion'
Code clean-up. * js/comma-semicolon-confusion: detect-compiler: detect clang even if it found CUDA clang: warn when the comma operator is used compat/regex: explicitly mark intentional use of the comma operator wildmatch: avoid using of the comma operator diff-delta: avoid using the comma operator xdiff: avoid using the comma operator unnecessarily clar: avoid using the comma operator unnecessarily kwset: avoid using the comma operator unnecessarily rebase: avoid using the comma operator unnecessarily remote-curl: avoid using the comma operator unnecessarilymaint
commit
7b03646f85
|
@ -1843,7 +1843,7 @@ int cmd_rebase(int argc,
|
||||||
strbuf_addf(&msg, "%s (start): checkout %s",
|
strbuf_addf(&msg, "%s (start): checkout %s",
|
||||||
options.reflog_action, options.onto_name);
|
options.reflog_action, options.onto_name);
|
||||||
ropts.oid = &options.onto->object.oid;
|
ropts.oid = &options.onto->object.oid;
|
||||||
ropts.orig_head = &options.orig_head->object.oid,
|
ropts.orig_head = &options.orig_head->object.oid;
|
||||||
ropts.flags = RESET_HEAD_DETACH | RESET_ORIG_HEAD |
|
ropts.flags = RESET_HEAD_DETACH | RESET_ORIG_HEAD |
|
||||||
RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
|
RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
|
||||||
ropts.head_msg = msg.buf;
|
ropts.head_msg = msg.buf;
|
||||||
|
|
|
@ -1232,7 +1232,10 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
|
||||||
is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; )
|
is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; )
|
||||||
{
|
{
|
||||||
if (dest->elems[id] == src->elems[is])
|
if (dest->elems[id] == src->elems[is])
|
||||||
is--, id--;
|
{
|
||||||
|
is--;
|
||||||
|
id--;
|
||||||
|
}
|
||||||
else if (dest->elems[id] < src->elems[is])
|
else if (dest->elems[id] < src->elems[is])
|
||||||
dest->elems[--sbase] = src->elems[is--];
|
dest->elems[--sbase] = src->elems[is--];
|
||||||
else /* if (dest->elems[id] > src->elems[is]) */
|
else /* if (dest->elems[id] > src->elems[is]) */
|
||||||
|
|
|
@ -2210,7 +2210,7 @@ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx,
|
||||||
/* mctx->bkref_ents may have changed, reload the pointer. */
|
/* mctx->bkref_ents may have changed, reload the pointer. */
|
||||||
entry = mctx->bkref_ents + enabled_idx;
|
entry = mctx->bkref_ents + enabled_idx;
|
||||||
}
|
}
|
||||||
while (enabled_idx++, entry++->more);
|
while ((void)enabled_idx++, entry++->more);
|
||||||
}
|
}
|
||||||
err = REG_NOERROR;
|
err = REG_NOERROR;
|
||||||
free_return:
|
free_return:
|
||||||
|
|
|
@ -41,6 +41,10 @@ DEVELOPER_CFLAGS += -Wwrite-strings
|
||||||
DEVELOPER_CFLAGS += -fno-common
|
DEVELOPER_CFLAGS += -fno-common
|
||||||
DEVELOPER_CFLAGS += -Wunreachable-code
|
DEVELOPER_CFLAGS += -Wunreachable-code
|
||||||
|
|
||||||
|
ifneq ($(filter clang9,$(COMPILER_FEATURES)),)
|
||||||
|
DEVELOPER_CFLAGS += -Wcomma
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
||||||
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
|
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -9,7 +9,7 @@ CC="$*"
|
||||||
#
|
#
|
||||||
# FreeBSD clang version 3.4.1 (tags/RELEASE...)
|
# FreeBSD clang version 3.4.1 (tags/RELEASE...)
|
||||||
get_version_line() {
|
get_version_line() {
|
||||||
LANG=C LC_ALL=C $CC -v 2>&1 | grep ' version '
|
LANG=C LC_ALL=C $CC -v 2>&1 | sed -n '/ version /{p;q;}'
|
||||||
}
|
}
|
||||||
|
|
||||||
get_family() {
|
get_family() {
|
||||||
|
|
36
diff-delta.c
36
diff-delta.c
|
@ -438,19 +438,31 @@ create_delta(const struct delta_index *index,
|
||||||
op = out + outpos++;
|
op = out + outpos++;
|
||||||
i = 0x80;
|
i = 0x80;
|
||||||
|
|
||||||
if (moff & 0x000000ff)
|
if (moff & 0x000000ff) {
|
||||||
out[outpos++] = moff >> 0, i |= 0x01;
|
out[outpos++] = moff >> 0;
|
||||||
if (moff & 0x0000ff00)
|
i |= 0x01;
|
||||||
out[outpos++] = moff >> 8, i |= 0x02;
|
}
|
||||||
if (moff & 0x00ff0000)
|
if (moff & 0x0000ff00) {
|
||||||
out[outpos++] = moff >> 16, i |= 0x04;
|
out[outpos++] = moff >> 8;
|
||||||
if (moff & 0xff000000)
|
i |= 0x02;
|
||||||
out[outpos++] = moff >> 24, i |= 0x08;
|
}
|
||||||
|
if (moff & 0x00ff0000) {
|
||||||
|
out[outpos++] = moff >> 16;
|
||||||
|
i |= 0x04;
|
||||||
|
}
|
||||||
|
if (moff & 0xff000000) {
|
||||||
|
out[outpos++] = moff >> 24;
|
||||||
|
i |= 0x08;
|
||||||
|
}
|
||||||
|
|
||||||
if (msize & 0x00ff)
|
if (msize & 0x00ff) {
|
||||||
out[outpos++] = msize >> 0, i |= 0x10;
|
out[outpos++] = msize >> 0;
|
||||||
if (msize & 0xff00)
|
i |= 0x10;
|
||||||
out[outpos++] = msize >> 8, i |= 0x20;
|
}
|
||||||
|
if (msize & 0xff00) {
|
||||||
|
out[outpos++] = msize >> 8;
|
||||||
|
i |= 0x20;
|
||||||
|
}
|
||||||
|
|
||||||
*op = i;
|
*op = i;
|
||||||
|
|
||||||
|
|
54
kwset.c
54
kwset.c
|
@ -197,10 +197,13 @@ kwsincr (kwset_t kws, char const *text, size_t len)
|
||||||
while (link && label != link->label)
|
while (link && label != link->label)
|
||||||
{
|
{
|
||||||
links[depth] = link;
|
links[depth] = link;
|
||||||
if (label < link->label)
|
if (label < link->label) {
|
||||||
dirs[depth++] = L, link = link->llink;
|
dirs[depth++] = L;
|
||||||
else
|
link = link->llink;
|
||||||
dirs[depth++] = R, link = link->rlink;
|
} else {
|
||||||
|
dirs[depth++] = R;
|
||||||
|
link = link->rlink;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The current character doesn't have an outgoing link at
|
/* The current character doesn't have an outgoing link at
|
||||||
|
@ -257,14 +260,14 @@ kwsincr (kwset_t kws, char const *text, size_t len)
|
||||||
switch (dirs[depth + 1])
|
switch (dirs[depth + 1])
|
||||||
{
|
{
|
||||||
case L:
|
case L:
|
||||||
r = links[depth], t = r->llink, rl = t->rlink;
|
r = links[depth]; t = r->llink; rl = t->rlink;
|
||||||
t->rlink = r, r->llink = rl;
|
t->rlink = r; r->llink = rl;
|
||||||
t->balance = r->balance = 0;
|
t->balance = r->balance = 0;
|
||||||
break;
|
break;
|
||||||
case R:
|
case R:
|
||||||
r = links[depth], l = r->llink, t = l->rlink;
|
r = links[depth]; l = r->llink; t = l->rlink;
|
||||||
rl = t->rlink, lr = t->llink;
|
rl = t->rlink; lr = t->llink;
|
||||||
t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl;
|
t->llink = l; l->rlink = lr; t->rlink = r; r->llink = rl;
|
||||||
l->balance = t->balance != 1 ? 0 : -1;
|
l->balance = t->balance != 1 ? 0 : -1;
|
||||||
r->balance = t->balance != (char) -1 ? 0 : 1;
|
r->balance = t->balance != (char) -1 ? 0 : 1;
|
||||||
t->balance = 0;
|
t->balance = 0;
|
||||||
|
@ -277,14 +280,14 @@ kwsincr (kwset_t kws, char const *text, size_t len)
|
||||||
switch (dirs[depth + 1])
|
switch (dirs[depth + 1])
|
||||||
{
|
{
|
||||||
case R:
|
case R:
|
||||||
l = links[depth], t = l->rlink, lr = t->llink;
|
l = links[depth]; t = l->rlink; lr = t->llink;
|
||||||
t->llink = l, l->rlink = lr;
|
t->llink = l; l->rlink = lr;
|
||||||
t->balance = l->balance = 0;
|
t->balance = l->balance = 0;
|
||||||
break;
|
break;
|
||||||
case L:
|
case L:
|
||||||
l = links[depth], r = l->rlink, t = r->llink;
|
l = links[depth]; r = l->rlink; t = r->llink;
|
||||||
lr = t->llink, rl = t->rlink;
|
lr = t->llink; rl = t->rlink;
|
||||||
t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl;
|
t->llink = l; l->rlink = lr; t->rlink = r; r->llink = rl;
|
||||||
l->balance = t->balance != 1 ? 0 : -1;
|
l->balance = t->balance != 1 ? 0 : -1;
|
||||||
r->balance = t->balance != (char) -1 ? 0 : 1;
|
r->balance = t->balance != (char) -1 ? 0 : 1;
|
||||||
t->balance = 0;
|
t->balance = 0;
|
||||||
|
@ -567,22 +570,22 @@ bmexec (kwset_t kws, char const *text, size_t size)
|
||||||
{
|
{
|
||||||
while (tp <= ep)
|
while (tp <= ep)
|
||||||
{
|
{
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
if (d == 0)
|
if (d == 0)
|
||||||
goto found;
|
goto found;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
if (d == 0)
|
if (d == 0)
|
||||||
goto found;
|
goto found;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
if (d == 0)
|
if (d == 0)
|
||||||
goto found;
|
goto found;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
d = d1[U(tp[-1])], tp += d;
|
d = d1[U(tp[-1])]; tp += d;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
found:
|
found:
|
||||||
|
@ -649,7 +652,8 @@ cwexec (kwset_t kws, char const *text, size_t len, struct kwsmatch *kwsmatch)
|
||||||
mch = NULL;
|
mch = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mch = text, accept = kwset->trie;
|
mch = text;
|
||||||
|
accept = kwset->trie;
|
||||||
goto match;
|
goto match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -715,6 +715,7 @@ libgit_dependencies = [ ]
|
||||||
# Makefile.
|
# Makefile.
|
||||||
if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
|
if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
|
||||||
foreach cflag : [
|
foreach cflag : [
|
||||||
|
'-Wcomma',
|
||||||
'-Wdeclaration-after-statement',
|
'-Wdeclaration-after-statement',
|
||||||
'-Wformat-security',
|
'-Wformat-security',
|
||||||
'-Wold-style-definition',
|
'-Wold-style-definition',
|
||||||
|
|
|
@ -1239,7 +1239,7 @@ static int fetch_git(struct discovery *heads,
|
||||||
packet_buf_flush(&preamble);
|
packet_buf_flush(&preamble);
|
||||||
|
|
||||||
memset(&rpc, 0, sizeof(rpc));
|
memset(&rpc, 0, sizeof(rpc));
|
||||||
rpc.service_name = "git-upload-pack",
|
rpc.service_name = "git-upload-pack";
|
||||||
rpc.gzip_request = 1;
|
rpc.gzip_request = 1;
|
||||||
|
|
||||||
err = rpc_service(&rpc, heads, args.v, &preamble, &rpc_result);
|
err = rpc_service(&rpc, heads, args.v, &preamble, &rpc_result);
|
||||||
|
@ -1401,7 +1401,7 @@ static int push_git(struct discovery *heads, int nr_spec, const char **specs)
|
||||||
packet_buf_flush(&preamble);
|
packet_buf_flush(&preamble);
|
||||||
|
|
||||||
memset(&rpc, 0, sizeof(rpc));
|
memset(&rpc, 0, sizeof(rpc));
|
||||||
rpc.service_name = "git-receive-pack",
|
rpc.service_name = "git-receive-pack";
|
||||||
|
|
||||||
err = rpc_service(&rpc, heads, args.v, &preamble, &rpc_result);
|
err = rpc_service(&rpc, heads, args.v, &preamble, &rpc_result);
|
||||||
if (rpc_result.len)
|
if (rpc_result.len)
|
||||||
|
|
|
@ -376,9 +376,12 @@ fs_copydir_helper(const char *source, const char *dest, int dest_mode)
|
||||||
mkdir(dest, dest_mode);
|
mkdir(dest, dest_mode);
|
||||||
|
|
||||||
cl_assert_(source_dir = opendir(source), "Could not open source dir");
|
cl_assert_(source_dir = opendir(source), "Could not open source dir");
|
||||||
while ((d = (errno = 0, readdir(source_dir))) != NULL) {
|
for (;;) {
|
||||||
char *child;
|
char *child;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
if ((d = readdir(source_dir)) == NULL)
|
||||||
|
break;
|
||||||
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -479,9 +482,12 @@ fs_rmdir_helper(const char *path)
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
|
|
||||||
cl_assert_(dir = opendir(path), "Could not open dir");
|
cl_assert_(dir = opendir(path), "Could not open dir");
|
||||||
while ((d = (errno = 0, readdir(dir))) != NULL) {
|
for (;;) {
|
||||||
char *child;
|
char *child;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
if ((d = readdir(dir)) == NULL)
|
||||||
|
break;
|
||||||
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
|
||||||
p_ch = '[';
|
p_ch = '[';
|
||||||
if (t_ch == p_ch)
|
if (t_ch == p_ch)
|
||||||
matched = 1;
|
matched = 1;
|
||||||
continue;
|
goto next;
|
||||||
}
|
}
|
||||||
if (CC_EQ(s,i, "alnum")) {
|
if (CC_EQ(s,i, "alnum")) {
|
||||||
if (ISALNUM(t_ch))
|
if (ISALNUM(t_ch))
|
||||||
|
@ -268,7 +268,10 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
|
||||||
p_ch = 0; /* This makes "prev_ch" get set to 0. */
|
p_ch = 0; /* This makes "prev_ch" get set to 0. */
|
||||||
} else if (t_ch == p_ch)
|
} else if (t_ch == p_ch)
|
||||||
matched = 1;
|
matched = 1;
|
||||||
} while (prev_ch = p_ch, (p_ch = *++p) != ']');
|
next:
|
||||||
|
prev_ch = p_ch;
|
||||||
|
p_ch = *++p;
|
||||||
|
} while (p_ch != ']');
|
||||||
if (matched == negated ||
|
if (matched == negated ||
|
||||||
((flags & WM_PATHNAME) && t_ch == '/'))
|
((flags & WM_PATHNAME) && t_ch == '/'))
|
||||||
return WM_NOMATCH;
|
return WM_NOMATCH;
|
||||||
|
|
|
@ -211,8 +211,10 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
|
||||||
for (d = fmax; d >= fmin; d -= 2) {
|
for (d = fmax; d >= fmin; d -= 2) {
|
||||||
i1 = XDL_MIN(kvdf[d], lim1);
|
i1 = XDL_MIN(kvdf[d], lim1);
|
||||||
i2 = i1 - d;
|
i2 = i1 - d;
|
||||||
if (lim2 < i2)
|
if (lim2 < i2) {
|
||||||
i1 = lim2 + d, i2 = lim2;
|
i1 = lim2 + d;
|
||||||
|
i2 = lim2;
|
||||||
|
}
|
||||||
if (fbest < i1 + i2) {
|
if (fbest < i1 + i2) {
|
||||||
fbest = i1 + i2;
|
fbest = i1 + i2;
|
||||||
fbest1 = i1;
|
fbest1 = i1;
|
||||||
|
@ -223,8 +225,10 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
|
||||||
for (d = bmax; d >= bmin; d -= 2) {
|
for (d = bmax; d >= bmin; d -= 2) {
|
||||||
i1 = XDL_MAX(off1, kvdb[d]);
|
i1 = XDL_MAX(off1, kvdb[d]);
|
||||||
i2 = i1 - d;
|
i2 = i1 - d;
|
||||||
if (i2 < off2)
|
if (i2 < off2) {
|
||||||
i1 = off2 + d, i2 = off2;
|
i1 = off2 + d;
|
||||||
|
i2 = off2;
|
||||||
|
}
|
||||||
if (i1 + i2 < bbest) {
|
if (i1 + i2 < bbest) {
|
||||||
bbest = i1 + i2;
|
bbest = i1 + i2;
|
||||||
bbest1 = i1;
|
bbest1 = i1;
|
||||||
|
|
Loading…
Reference in New Issue