Patchwork D11445: dirstate: fix compilation warnings in `dirstate_item_set_possibly_dirty()`

login
register
mail settings
Submitter phabricator
Date Sept. 17, 2021, 12:07 a.m.
Message ID <differential-rev-PHID-DREV-z3y25ol3vphkg5xywxjl-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49760/
State Superseded
Headers show

Comments

phabricator - Sept. 17, 2021, 12:07 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Since https://phab.mercurial-scm.org/D11387 (i.e. the same patch as
  mentioned in my previous patch), Clang has also started warning about
  `dirstate_item_set_possibly_dirty()` missing an explicit return, and
  about its use of the result of an assignment as a condition without
  using parentheses. This patch fixes that. I don't know if `return
  NULL` was the intent.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11445

AFFECTED FILES
  mercurial/cext/parsers.c

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -487,9 +487,11 @@ 
    to make sure it is correct. */
 static PyObject *dirstate_item_set_possibly_dirty(dirstateItemObject *self)
 {
-	if (self->flags |= dirstate_flag_possibly_dirty) {
+	self->flags |= dirstate_flag_possibly_dirty;
+	if (self->flags) {
 		Py_RETURN_NONE;
 	}
+	return NULL;
 }
 
 /* See docstring of the python implementation for details */