All of lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Source code clean-up for parentheses?
Date: Sun, 21 Dec 2014 14:44:40 +0100	[thread overview]
Message-ID: <5496CEC8.9020304@users.sourceforge.net> (raw)
In-Reply-To: <FD60F271-AC55-439C-A6D0-56186C3CD9F1@gmail.com>

> Given that coccinelle understands c structure, and knows about common isomorphisms,
> is there an easy way so that I can instruct it to analyze every expression in
> my source code, and remove parentheses at every place they?re not needed?

There are various preconditions to consider.


> By not needed, I mean that the c expression meaning (taking into account operator
> precedence and the like) is the same with and without parentheses.

Software developers and source code reviewers can have strong opinions about the
placement for their parentheses.

Coding style specifications often recommend a code structure for reasonable
readability and not what compilation software can handle in principle.


> I?m working with a 200000 LOC codebase. So, if there?s no dependable way to do this
> (without false positives and the like), then I?d have to manually review every change.

Which error rate can you tolerate for your source code analysis and
eventually automatic transformations?

Do you get further ideas from the section "4.2.1 How to remove useless parentheses?"
in Coccinelle's manual?


> Feasibility of that depends on how many instances are found, which I cannot now
> in advance. If they are too many and I have to review them manually,
> then this is probably not worth the trouble.

Do efforts naturally evolve with the desire to come closer to a kind of perfection?

Regards,
Markus

  reply	other threads:[~2014-12-21 13:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-20 20:21 [Cocci] Change function invocations argument Eliseo Martínez
2014-12-20 20:32 ` Julia Lawall
2014-12-20 20:45   ` Eliseo Martínez
2014-12-20 20:51     ` Julia Lawall
2014-12-21 10:43       ` Eliseo Martínez
2014-12-21 10:57         ` Julia Lawall
2014-12-21 11:14           ` Eliseo Martínez
2014-12-21 11:16             ` Julia Lawall
2014-12-21 11:19               ` Eliseo Martínez
2014-12-21 11:20                 ` Julia Lawall
2014-12-21 11:55             ` SF Markus Elfring
2014-12-21 12:04               ` Julia Lawall
2014-12-21 12:24                 ` Eliseo Martínez
2014-12-21 12:49                   ` SF Markus Elfring
2014-12-21 12:50                     ` Eliseo Martínez
2014-12-21 12:55                       ` SF Markus Elfring
2014-12-21 13:12                         ` Eliseo Martínez
2014-12-21 13:44                           ` SF Markus Elfring [this message]
2014-12-21 13:48                             ` [Cocci] Source code clean-up for parentheses? SF Markus Elfring
2014-12-21 14:13                           ` [Cocci] Change function invocations argument Julia Lawall
2014-12-21 14:01                   ` Julia Lawall
2014-12-22 13:33                     ` Michael Stefaniuc

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=5496CEC8.9020304@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=cocci@systeme.lip6.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.