[PATCH 0/4] Fix minor warnings reported by icc

DORMANTno replies

6 messages, 1 author, 2016-06-15 · open the first message on its own page

[PATCH 0/4] Fix minor warnings reported by icc

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:29

Hi,

Thomas Rast tried compiling Git with Intel's C compiler (icc) recently
and the results can be found here [1].  Most of them don't amount to
anything, are probably not worth fixing.  Here are fixes to a few that
caught my eye.

Thanks.

[1]: https://gist.github.com/1367335

-- Ram

Ramkumar Ramachandra (4):
  http: remove unused function hex()
  convert: don't mix enum with int
  ll-merge: initialize default_opts const
  sha1_file: don't mix enum with int

 convert.c   |    6 +++---
 http.c      |    8 --------
 ll-merge.c  |    2 +-
 sha1_file.c |    2 +-
 4 files changed, 5 insertions(+), 13 deletions(-)

-- 
1.7.6.351.gb35ac.dirty

[PATCH 2/4] convert: don't mix enum with int

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:29

Signed-off-by: Ramkumar Ramachandra <redacted>
---
 convert.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/convert.c b/convert.c
index 3bb5a4d..038b0be 100644
--- a/convert.c
+++ b/convert.c
@@ -641,7 +641,7 @@ static int ident_to_worktree(const char *path, const char *src, size_t len,
 	return 1;
 }
 
-static int git_path_check_crlf(const char *path, struct git_attr_check *check)
+static enum crlf_action git_path_check_crlf(const char *path, struct git_attr_check *check)
 {
 	const char *value = check->value;
 
@@ -658,7 +658,7 @@ static int git_path_check_crlf(const char *path, struct git_attr_check *check)
 	return CRLF_GUESS;
 }
 
-static int git_path_check_eol(const char *path, struct git_attr_check *check)
+static enum crlf_action git_path_check_eol(const char *path, struct git_attr_check *check)
 {
 	const char *value = check->value;
 
@@ -811,7 +811,7 @@ int renormalize_buffer(const char *path, const char *src, size_t len, struct str
 		src = dst->buf;
 		len = dst->len;
 	}
-	return ret | convert_to_git(path, src, len, dst, 0);
+	return ret | convert_to_git(path, src, len, dst, SAFE_CRLF_FALSE);
 }
 
 /*****************************************************************
-- 
1.7.6.351.gb35ac.dirty

[PATCH 1/4] http: remove unused function hex()

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:29

Signed-off-by: Ramkumar Ramachandra <redacted>
---
 http.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/http.c b/http.c
index 008ad72..e6c7597 100644
--- a/http.c
+++ b/http.c
@@ -747,14 +747,6 @@ static inline int needs_quote(int ch)
 	return 1;
 }
 
-static inline int hex(int v)
-{
-	if (v < 10)
-		return '0' + v;
-	else
-		return 'A' + v - 10;
-}
-
 static char *quote_ref_url(const char *base, const char *ref)
 {
 	struct strbuf buf = STRBUF_INIT;
-- 
1.7.6.351.gb35ac.dirty

[PATCH 3/4] ll-merge: initialize default_opts const

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:29

Signed-off-by: Ramkumar Ramachandra <redacted>
---
 ll-merge.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ll-merge.c b/ll-merge.c
index da59738..205aed3 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -351,7 +351,7 @@ int ll_merge(mmbuffer_t *result_buf,
 	     const struct ll_merge_options *opts)
 {
 	static struct git_attr_check check[2];
-	static const struct ll_merge_options default_opts;
+	static const struct ll_merge_options default_opts = {0, 0, 0, 0};
 	const char *ll_driver_name = NULL;
 	int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
 	const struct ll_merge_driver *driver;
-- 
1.7.6.351.gb35ac.dirty

[PATCH 4/4] sha1_file: don't mix enum with int

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:29

Signed-off-by: Ramkumar Ramachandra <redacted>
---
 sha1_file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 27f3b9b..869852b 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2616,7 +2616,7 @@ static int index_mem(unsigned char *sha1, void *buf, size_t size,
 	if ((type == OBJ_BLOB) && path) {
 		struct strbuf nbuf = STRBUF_INIT;
 		if (convert_to_git(path, buf, size, &nbuf,
-		                   write_object ? safe_crlf : 0)) {
+		                   write_object ? safe_crlf : SAFE_CRLF_FALSE)) {
 			buf = strbuf_detach(&nbuf, &size);
 			re_allocated = 1;
 		}
-- 
1.7.6.351.gb35ac.dirty

[PATCH 5/4] git-compat-util: don't assume value for undefined variable

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:29

Suggested-by: Thomas Rast <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
---
 And here's another probably worth fixing.

 git-compat-util.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 5ef8ff7..8b4dd5c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -219,7 +219,7 @@ extern char *gitbasename(char *);
 #define find_last_dir_sep(path) strrchr(path, '/')
 #endif
 
-#if __HP_cc >= 61000
+#if defined(__HP_cc) && (__HP_cc >= 61000)
 #define NORETURN __attribute__((noreturn))
 #define NORETURN_PTR
 #elif defined(__GNUC__) && !defined(NO_NORETURN)
-- 
1.7.6.351.gb35ac.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help