From: Matthieu Moy Date: Mon, 04 Oct 2010 11:45:27 GMT Subject: Re: [PATCH] diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warning Message-ID: In-Reply-To: <4CA9B217.6050600@lsrfire.ath.cx> René Scharfe writes: > How about something like the following instead? > diff --git a/cache.h b/cache.h > index 2ef2fa3..3d5ed51 100644 > --- a/cache.h > +++ b/cache.h > @@ -277,9 +277,16 @@ static inline int ce_to_dtype(const struct cache_entry *ce) > else > return DT_UNKNOWN; > } > -#define canon_mode(mode) \ > - (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \ > - S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK) > +static inline unsigned int canon_mode(unsigned int mode) > +{ > + if (S_ISREG(mode)) > + return S_IFREG | ce_permissions(mode); > + if (S_ISLNK(mode)) > + return S_IFLNK; > + if (S_ISDIR(mode)) > + return S_IFDIR; > + return S_IFGITLINK; > +} That sounds much better to me. I don't know whether it fixes the issue on NetBSD though. -- Matthieu Moy http://www-verimag.imag.fr/~moy/