# [PATCH] Fix warning about bitfield in struct ref

4 messages from 2007-11-18 to 2007-11-21. Participants: Shawn O. Pearce, Johannes Schindelin.
Thread: https://gitlist.dev/t/10913

## Shawn O. Pearce, 2007-11-18 09:31

Subject: [PATCH] Fix warning about bitfield in struct ref
Message-ID: <20071118093137.GA2196@spearce.org>
URL: https://gitlist.dev/e/20071118093137.GA2196%40spearce.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

```

## Johannes Schindelin, 2007-11-19 23:58

Subject: Re: [PATCH] Fix warning about bitfield in struct ref
Message-ID: <Pine.LNX.4.64.0711200058270.16728@wbgn129.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0711200058270.16728%40wbgn129.biozentrum.uni-wuerzburg.de
In-Reply-To: <20071118093137.GA2196@spearce.org>

```
Hi,

On Sun, 18 Nov 2007, Shawn O. Pearce wrote:

> +	unsigned int force:1,

Isn't this "unsigned force:1" everywhere else in git's source?

Ciao,
Dscho

```

## Shawn O. Pearce, 2007-11-21 06:51

Subject: Re: [PATCH] Fix warning about bitfield in struct ref
Message-ID: <20071121065155.GT14735@spearce.org>
URL: https://gitlist.dev/e/20071121065155.GT14735%40spearce.org
In-Reply-To: <Pine.LNX.4.64.0711200058270.16728@wbgn129.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Sun, 18 Nov 2007, Shawn O. Pearce wrote:
> 
> > +	unsigned int force:1,
> 
> Isn't this "unsigned force:1" everywhere else in git's source?

That may be true but Junio already applied it as "unsigned int"
as I wrote it.  Anyway "unsigned int" and "unsigned" will give the
same result here; I just typed 4 characters more than I needed to.

-- 
Shawn.

```

## Johannes Schindelin, 2007-11-21 11:59

Subject: Re: [PATCH] Fix warning about bitfield in struct ref
Message-ID: <Pine.LNX.4.64.0711211158450.27959@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0711211158450.27959%40racer.site
In-Reply-To: <20071121065155.GT14735@spearce.org>

```
Hi,

On Wed, 21 Nov 2007, Shawn O. Pearce wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > On Sun, 18 Nov 2007, Shawn O. Pearce wrote:
> > 
> > > +	unsigned int force:1,
> > 
> > Isn't this "unsigned force:1" everywhere else in git's source?
> 
> That may be true but Junio already applied it as "unsigned int"
> as I wrote it.

Yes, I saw that _after_ I wrote this mail.

> Anyway "unsigned int" and "unsigned" will give the same result here; I 
> just typed 4 characters more than I needed to.

No big problem.

Ciao,
Dscho

```
