summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d7a10c3)
raw | patch | inline | side by side (parent: d7a10c3)
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | |
Wed, 21 Dec 2011 01:18:20 +0000 (01:18 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 21 Dec 2011 18:19:40 +0000 (10:19 -0800) |
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>
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>
test-treap.c | patch | blob | history | |
vcs-svn/repo_tree.c | patch | blob | history | |
vcs-svn/string_pool.c | patch | blob | history |
diff --git a/test-treap.c b/test-treap.c
index ab8c951c6eb39f54a9885dd15c173f974d7357d5..294d7ee2737099c94a7d768d47c6a316a6860cd7 100644 (file)
--- a/test-treap.c
+++ b/test-treap.c
int main(int argc, char *argv[])
{
struct strbuf sb = STRBUF_INIT;
- struct trp_root root = { ~0 };
+ struct trp_root root = { ~0U };
uint32_t item;
if (argc != 1)
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index a21d89de97404479ecf2ca46824f61acb7af56e6..c3f198d29a4b90ee5959be750de0b764b5ea59e6 100644 (file)
--- a/vcs-svn/repo_tree.c
+++ b/vcs-svn/repo_tree.c
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;
diff --git a/vcs-svn/string_pool.c b/vcs-svn/string_pool.c
index 8af8d54d6ef41a2e84e500bd0d1a5523e59f8a32..1b63b19a383c570f69b9456c66170e592c49d9ba 100644 (file)
--- a/vcs-svn/string_pool.c
+++ b/vcs-svn/string_pool.c
#include "obj_pool.h"
#include "string_pool.h"
-static struct trp_root tree = { ~0 };
+static struct trp_root tree = { ~0U };
struct node {
uint32_t offset;
uint32_t pool_tok_seq(uint32_t sz, uint32_t *seq, const char *delim, char *str)
{
char *context = NULL;
- uint32_t token = ~0;
+ uint32_t token = ~0U;
uint32_t length;
if (sz == 0)