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

[PATCH] diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warning

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 4, 2010, 09:21 UTC
Message-ID
<1286184071-28457-1-git-send-email-avarab@gmail.com>

Wrap "S_IFREG | 0644" in parentheses to avoid a "suggest parentheses around arithmetic in operand of |" warning from GCC 4.1.3 on NetBSD 5.0.2.

I spotted and fixed this independently on NetBSD, but later found that there was a NetBSD Problem Report that included this fix.

NetBSD-PR: http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=42168
Reported-by: Dan McMahill <dmcmahill@NetBSD.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/diff.c b/builtin/diff.c
index a43d326..e8b7e09 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -93,7 +93,7 @@ static int builtin_diff_blobs(struct rev_info *revs,
 			      int argc, const char **argv,
 			      struct blobinfo *blob)
 {
-	unsigned mode = canon_mode(S_IFREG | 0644);
+	unsigned mode = canon_mode((S_IFREG | 0644));
 
 	if (argc > 1)
 		usage(builtin_diff_usage);
-- 
1.7.3.159.g610493
Next: Jonathan Nieder
Message 1 of 13 in “diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warning”
  1. diff: "S_IFREG | 0644" to "(S_IFREG | 0644)" to avoid warningÆvar Arnfjörð Bjarmason, Oct 4, 2010
  2. Jonathan NiederOct 4, 2010
  3. Ævar Arnfjörð BjarmasonOct 4, 2010
  4. Junio C HamanoOct 4, 2010
  5. cache.h: work around broken NetBSD system headersÆvar Arnfjörð Bjarmason, Oct 4, 2010
  6. Ævar Arnfjörð BjarmasonOct 4, 2010
  7. Jonathan NiederOct 4, 2010
  8. Jonathan NiederOct 4, 2010
  9. René ScharfeOct 4, 2010
  10. Matthieu MoyOct 4, 2010
  11. Junio C HamanoOct 4, 2010
  12. René ScharfeOct 4, 2010
  13. yj2133011Oct 4, 2010

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.