Re: [PATCH] diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warning
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Oct 4, 2010, 09:35 UTC
- Message-ID
- <20101004093519.GN24884@burratino>
- In-Reply-To
- <1286184071-28457-1-git-send-email-avarab@gmail.com>
Ævar Arnfjörð Bjarmason wrote:
> - unsigned mode = canon_mode(S_IFREG | 0644); > + unsigned mode = canon_mode((S_IFREG | 0644));
Just curious:
#define canon_mode(mode) \
(S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK)#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
Since S_ISREG et al are macros, typically they would put their argument in parentheses in the definition. How are they defined in NetBSD sys/stat.h? What is canon_mode(S_IFREG | 0644) being misinterpreted to mean?