diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2011-12-21 01:18:20 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2011-12-21 10:19:40 -0800 |
| commit | 952fba9c63417d19e01fdf0b714f01b8ae9f3618 (patch) | |
| tree | b819d51bf6072f894cd0f1e7abf4e69ccfecca43 /vcs-svn/repo_tree.c | |
| parent | Fix an enum assignment issue spotted by Sun Studio (diff) | |
| download | git-952fba9c63417d19e01fdf0b714f01b8ae9f3618.tar.gz git-952fba9c63417d19e01fdf0b714f01b8ae9f3618.zip | |
Fix a bitwise negation assignment issue spotted by Sun Studio
Change direct and indirect assignments of the bitwise negation of 0 to
uint32_t variables to have a "U" suffix. I.e. ~0U instead of ~0. This
eliminates warnings under Sun Studio 12 Update 1:
"vcs-svn/string_pool.c", line 11: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
"vcs-svn/string_pool.c", line 81: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
"vcs-svn/repo_tree.c", line 112: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
"vcs-svn/repo_tree.c", line 112: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
"test-treap.c", line 34: warning: initializer will be sign-extended: -1 (E_INIT_SIGN_EXTEND)
The semantics are still the same as demonstrated by this program:
$ cat test.c && make test && ./test
#include <stdio.h>
#include <stdint.h>
int main(void)
{
uint32_t foo = ~0;
uint32_t bar = ~0U;
printf("foo = <%u> bar = <%u>\n", foo, bar);
return 0;
}
cc test.c -o test
"test.c", line 5: warning: initializer will be sign-extended: -1
foo = <4294967295> bar = <4294967295>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'vcs-svn/repo_tree.c')
| -rw-r--r-- | vcs-svn/repo_tree.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c index a21d89de97..c3f198d29a 100644 --- a/vcs-svn/repo_tree.c +++ b/vcs-svn/repo_tree.c @@ -109,7 +109,7 @@ static struct repo_dirent *repo_read_dirent(uint32_t revision, static void repo_write_dirent(const uint32_t *path, uint32_t mode, uint32_t content_offset, uint32_t del) { - uint32_t name, revision, dir_o = ~0, parent_dir_o = ~0; + uint32_t name, revision, dir_o = ~0U, parent_dir_o = ~0U; struct repo_dir *dir; struct repo_dirent *key; struct repo_dirent *dent = NULL; |
