git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix warning about bitfield in struct ref

From
Shawn O. Pearce <spearce@spearce.org>
Date
Nov 18, 2007, 09:31 UTC
Message-ID
<20071118093137.GA2196@spearce.org>

cache.h:503: warning: type of bit-field 'force' is a GCC extension cache.h:504: warning: type of bit-field 'merge' is a GCC extension cache.h:505: warning: type of bit-field 'nonfastforward' is a GCC extension cache.h:506: warning: type of bit-field 'deletion' is a GCC extension

So we change it to an 'unsigned int' which is not a GCC extension.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 cache.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cache.h b/cache.h
index ba9178f..65e019e 100644
--- a/cache.h
+++ b/cache.h
@@ -500,10 +500,10 @@ struct ref {
 	struct ref *next;
 	unsigned char old_sha1[20];
 	unsigned char new_sha1[20];
-	unsigned char force : 1;
-	unsigned char merge : 1;
-	unsigned char nonfastforward : 1;
-	unsigned char deletion : 1;
+	unsigned int force:1,
+		merge:1,
+		nonfastforward:1,
+		deletion:1;
 	enum {
 		REF_STATUS_NONE = 0,
 		REF_STATUS_OK,
-- 
1.5.3.5.1794.g083e
Next: Johannes Schindelin
Message 1 of 4 in “Fix warning about bitfield in struct ref”
  1. Fix warning about bitfield in struct refShawn O. Pearce, Nov 18, 2007
  2. Johannes SchindelinNov 19, 2007
  3. Shawn O. PearceNov 21, 2007
  4. Johannes SchindelinNov 21, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.