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

[PATCH QGit] Fix compiler warning due to ambiguous 'else'

From
Markus Heidelberg <markus.heidelberg@web.de>
Date
Jun 12, 2009, 12:07 UTC
Message-ID
<1244808481-13012-1-git-send-email-markus.heidelberg@web.de>
g++ 4.3.2 produced the following warning:

treeview.cpp: In member function ‘void TreeView::updateTree()’: treeview.cpp:221: warning: suggest explicit braces to avoid ambiguous ‘else’

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 src/treeview.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/treeview.cpp b/src/treeview.cpp
index 346c577..d391a32 100644
--- a/src/treeview.cpp
+++ b/src/treeview.cpp
@@ -222,7 +222,7 @@ void TreeView::updateTree() {
 	    && treeIsValid
 	    && root
 	    && st->sha() != QGit::ZERO_SHA
-	    && root->treeSha != QGit::ZERO_SHA)
+	    && root->treeSha != QGit::ZERO_SHA) {
 		// root->treeSha could reference a different sha from current
 		// one in case the tree is the same, i.e. has the same files.
 		// so we prefer to use the previous state sha to call isSameFiles()
@@ -233,6 +233,7 @@ void TreeView::updateTree() {
 			newTree = !git->isSameFiles(st->sha(false), st->sha(true));
 		else
 			newTree = !git->isSameFiles(root->treeSha, st->sha(true));
+	}
 
 	if (newTree) // ok, we really need to update the tree
 		setTree(st->sha());
-- 
1.6.3.2.236.ge505d
Message 1 of 1 in “Fix compiler warning due to ambiguous 'else'”
  1. Fix compiler warning due to ambiguous 'else'Markus Heidelberg, Jun 12, 2009

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.