Re: [PATCH] GSoC Micoproject: Hunt down signed int flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]