diff mbox

[1/3] Target-microblaze: Remove unnecessary variable

Message ID 1443170278-9318-1-git-send-email-shraddha.6596@gmail.com
State New
Headers show

Commit Message

Shraddha Barke Sept. 25, 2015, 8:37 a.m. UTC
Compress lines and remove the variable .

Change made using Coccinelle script

@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;
@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;
@@
type T; identifier i;
@@
- T i;
... when != i

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 target-microblaze/op_helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Michael Tokarev Oct. 3, 2015, 4:50 p.m. UTC | #1
25.09.2015 11:37, Shraddha Barke wrote:
> Compress lines and remove the variable .

Applied to -trivial, removing this piece of commit message:

---
> Change made using Coccinelle script
> 
> @@
> expression ret;
> @@
> - if (ret) return ret;
> - return 0;
> + return ret;
> @@
> local idexpression ret;
> expression e;
> @@
> - ret = e;
> - return ret;
> + return e;
> @@
> type T; identifier i;
> @@
> - T i;
> ... when != i
---

Thanks,

/mjt
Markus Armbruster Oct. 5, 2015, 5:18 a.m. UTC | #2
Michael Tokarev <mjt@tls.msk.ru> writes:

> 25.09.2015 11:37, Shraddha Barke wrote:
>> Compress lines and remove the variable .
>
> Applied to -trivial, removing this piece of commit message:
>
> ---
>> Change made using Coccinelle script
>> 
>> @@
>> expression ret;
>> @@
>> - if (ret) return ret;
>> - return 0;
>> + return ret;
>> @@
>> local idexpression ret;
>> expression e;
>> @@
>> - ret = e;
>> - return ret;
>> + return e;
>> @@
>> type T; identifier i;
>> @@
>> - T i;
>> ... when != i
> ---

Why?  I like having the semantic patch in the commit message when
there's any chance we'll want do the same mechanical change again later.

You could save space and include it by reference, though: "Same
Coccinelle semantic patch as is commit 74c373e".
Michael Tokarev Oct. 5, 2015, 7:18 a.m. UTC | #3
05.10.2015 08:18, Markus Armbruster wrote:
> Michael Tokarev <mjt@tls.msk.ru> writes:
> 
>> 25.09.2015 11:37, Shraddha Barke wrote:
>>> Compress lines and remove the variable .
>>
>> Applied to -trivial, removing this piece of commit message:
>>
>> ---
>>> Change made using Coccinelle script
[..snip..]
>> ---
> 
> Why?  I like having the semantic patch in the commit message when
> there's any chance we'll want do the same mechanical change again later.
> 
> You could save space and include it by reference, though: "Same
> Coccinelle semantic patch as is commit 74c373e".

git commit messages aren't good documentation for various scripts
like this, this info will be lost in the noize.  If it might be
better to keep such scripts in a separate file where it is easier
to find, or in a wiki page on the site. The key point is where to
find the info, git log is difficult for that, especially when you
don't know what to search for or that such a script exists in
there in the first place.

On the other hand, when git log is cluttered by such a long messages
for such small changes, it becomes more difficult to find info which
you really look in git log -- namely, which changes were made that
might have introduced this regression, things like that.

So to me, the shorter and cleaner the commit message is, the better.

BTW, I've no idea why this email has been Cc'd to kvm@vger :)

Thanks,

/mjt
Peter Maydell Oct. 5, 2015, 7:53 a.m. UTC | #4
On 5 October 2015 at 08:18, Michael Tokarev <mjt@tls.msk.ru> wrote:
> 05.10.2015 08:18, Markus Armbruster wrote:
>> Why?  I like having the semantic patch in the commit message when
>> there's any chance we'll want do the same mechanical change again later.
>>
>> You could save space and include it by reference, though: "Same
>> Coccinelle semantic patch as is commit 74c373e".
>
> git commit messages aren't good documentation for various scripts
> like this, this info will be lost in the noize.  If it might be
> better to keep such scripts in a separate file where it is easier
> to find, or in a wiki page on the site. The key point is where to
> find the info, git log is difficult for that, especially when you
> don't know what to search for or that such a script exists in
> there in the first place.
>
> On the other hand, when git log is cluttered by such a long messages
> for such small changes, it becomes more difficult to find info which
> you really look in git log -- namely, which changes were made that
> might have introduced this regression, things like that.

I think it can be useful when you're looking at a commit
to know that it was automatically created, especially if
it's a big commit. It means that if you're looking for
a bug in it you can concentrate on the script that created
it rather than the possibly large set of changes it produced,
or if you're trying to cherry-pick it into another branch you
can just apply the script instead.

In a commit with a change this small it's not very significant
either way, though.

thanks
-- PMM
diff mbox

Patch

diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index d2b3624..d2f411a 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -151,9 +151,7 @@  uint32_t helper_clz(uint32_t t0)
 
 uint32_t helper_carry(uint32_t a, uint32_t b, uint32_t cf)
 {
-    uint32_t ncf;
-    ncf = compute_carry(a, b, cf);
-    return ncf;
+    return compute_carry(a, b, cf);
 }
 
 static inline int div_prepare(CPUMBState *env, uint32_t a, uint32_t b)