[PATCH nd/struct-pathspec] declare 1-bit bitfields to be unsigned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As "gcc -pedantic" notices, a two's complement 1-bit signed integer
cannot represent the value '1'.

 dir.c: In function 'init_pathspec':
 dir.c:1291:4: warning: overflow in implicit constant conversion [-Woverflow]

In the spirit of v1.7.1-rc1~10 (2010-04-06), 'unsigned' is what was
intended, so let's make the flags unsigned.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
Jonathan Nieder wrote:

> I had the somewhat
> insane idea of turning on as many warnings as feasible and getting git
> to build with -Werror.

Here's another one.  Based against f577b92 from master (aka
nd/struct-pathspec).

 cache.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cache.h b/cache.h
index 4beb2dc..edd5b5a 100644
--- a/cache.h
+++ b/cache.h
@@ -503,13 +503,13 @@ extern int ie_modified(const struct index_state *, struct cache_entry *, struct
 struct pathspec {
 	const char **raw; /* get_pathspec() result, not freed by free_pathspec() */
 	int nr;
-	int has_wildcard:1;
-	int recursive:1;
+	unsigned int has_wildcard:1;
+	unsigned int recursive:1;
 	int max_depth;
 	struct pathspec_item {
 		const char *match;
 		int len;
-		int has_wildcard:1;
+		unsigned int has_wildcard:1;
 	} *items;
 };
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]