From: Moritz Neeb <lists@moritzneeb.de>
To: Saurav Sachidanand <sauravsachidanand@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] GSoC Micoproject: Hunt down signed int flags
Date: Mon, 22 Feb 2016 00:22:11 +0100 [thread overview]
Message-ID: <56CA46A3.9060404@moritzneeb.de> (raw)
In-Reply-To: <1456053189-5221-1-git-send-email-sauravsachidanand@gmail.com>
Thanks for your patch. Just to let you know, this will be my first
review, but I hope it will be helpful anyway. I will mostly review your
commit text. First some general remarks:
The text you are submitting with you email is directly used as commit
message (the email subject as well, as the first line). You might want
to take care that the description is useful as a "bit of history", I
will give examples of what I mean below. Some guidelines for that can be
found in "Documentation/SubmittingPatches" section (2).
On 02/21/2016 12:13 PM, Saurav Sachidanand wrote:
> This is patch is for a suggested micro project for GSoC 2016; namely,
> that of searching for a field of a struct that is of signed integral
> type and used as a collection of multiple bits, and converting it to
> an unsigned type if the MSB isn’t used in any special way.
Especially, you might not want to include the fact that this is a GSoC
project. You might want to add this kind of information in the
"notes"-section of your email after the three dashes "---", this will be
skipped when the patch is applied.
> Two structs, `pattern` defined in attr.c and `exclude` defined in dir.h,
> have a `flags` field of signed int type.
I have never seen the Markdown-style quotes ` in git.git commits. To be
in the same style as previous git (which helps e.g. in readability
because it is homogeneous), you can use the "-quote for code. Or even
leave them out if its clear from context.
> The fields of both structs take
> on values from the same set of positive integers {1, 4, 8, 16},
> enumerated through the marco EXC_FLAG_*.
marco -> macro.
I'd say this is a good observation to state.
Maybe it's also helpful to further explain why the two structs are
logically connected, or if that turns out to be false, to split up you
changes into two commits. I am not fully convinced that it should be one
commit.
>`pattern` is used only in attr.c,
> and `exclude` is used only in builtin/check-ignore.c and dir.c, and in
> those files, either, the value of `flags` is checked using the `&` operator
> (e.g.: flags & EXC_FLAG_NODIR), or the value of `flags` is first set to 0
> and then set to any one of {1, 4, 8, 16} using the `|=` operator
> (e.g.: flags |= EXC_FLAG_NODIR). And, so it does not appear that the MSB
> of `flags` is used in any special way.
This is the conclusion that is needed, but you might want state it more
direct, like "the MSB is not used...".
> Therefore, I thought to change the
> type of `flags` in the definitions of both structs to `unsigned int`.
> Furthermore, `flags` is passed by reference (of `pattern` in attr.c and of
> `exclude` in dir.c) to the function `parse_exclude_pattern` defined in
> dir.c, that accepts an `int *` type for `flags`.
> When make was run, it gave
> a warning for ‘converting between pointers to integer types of different
> sign’, so I changed the type of that respective argument to `unsigned int *`.
I think this explanation can be left out or has to be replaced by
something less compiler-driven, i.e. why does it actually make sense for
parse_exclude_pattern to have an unsigned int flags as parameter.
> In the end, running make to build didn’t produce any more warnings, and
> running make in t/ didn’t produce any breakage that wasn’t ‘#TODO known
> breakage’.
For the tests it is, from what I've seen, just assumed that you ran them
(and the reviewers/the maintainer will confirm this for themselves), so
no need to mention it. But it's good you ran them.
> I also thought it’d be helpful to add the comment /* EXC_FLAG_* */ next
> to `flags` of `exclude`, just like it exists for `flags` of `pattern`.
I would reformulate this as well more direct to something like "when
we're at it, document exclude->flags as EXC_FLAG".
Thanks,
Moritz
next prev parent reply other threads:[~2016-02-21 23:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-21 11:13 [PATCH] GSoC Micoproject: Hunt down signed int flags Saurav Sachidanand
2016-02-21 23:22 ` Moritz Neeb [this message]
2016-02-22 0:48 ` Eric Sunshine
2016-02-22 9:32 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56CA46A3.9060404@moritzneeb.de \
--to=lists@moritzneeb.de \
--cc=git@vger.kernel.org \
--cc=sauravsachidanand@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).