Mercurial > public > mercurial-scm > hg
diff mercurial/cext/parsers.c @ 47975:ec178161a8d1
dirstate: make dirstate flags char be unsigned
Since https://phab.mercurial-scm.org/D11387, `CC='clang -Werror' make
local` has started failing like this:
```
mercurial/cext/util.h:41:50: error: implicit conversion from 'int' to 'char' changes value from 128 to -128 [-Werror,-Wconstant-conversion]
static const char dirstate_flag_rust_special = 1 << 7;
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~^~~~
```
This patch fixes that by making the flags be an unsigned char. That
also matches the `bool` typedef we have in `util.h`, which seems good
since many of the `dirstate_item_c_*()` functions return a `bool`.
Differential Revision: https://phab.mercurial-scm.org/D11444
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 16 Sep 2021 16:29:55 -0700 |
parents | 4e6f27230aee |
children | 2018753014be |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Thu Sep 02 03:59:35 2021 +0200 +++ b/mercurial/cext/parsers.c Thu Sep 16 16:29:55 2021 -0700 @@ -144,9 +144,10 @@ static inline bool dirstate_item_c_added(dirstateItemObject *self) { - char mask = (dirstate_flag_wc_tracked | dirstate_flag_p1_tracked | - dirstate_flag_p2_tracked); - char target = dirstate_flag_wc_tracked; + unsigned char mask = + (dirstate_flag_wc_tracked | dirstate_flag_p1_tracked | + dirstate_flag_p2_tracked); + unsigned char target = dirstate_flag_wc_tracked; return (self->flags & mask) == target; }