
On Fri, Sep 27, 2019 at 10:33:45 +0100, Daniel Berrange wrote:
On Thu, Sep 26, 2019 at 06:08:14PM +0200, Ján Tomko wrote:
On Tue, Sep 24, 2019 at 03:58:46PM +0100, Daniel P. Berrangé wrote:
As part of an goal to eliminate Perl from libvirt build tools, rewrite the check-spacing.pl tool in Python.
This was a straight conversion, manually going line-by-line to change the syntax from Perl to Python. Thus the overall structure of the file and approach is the same.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> ---
[...]
I have played with clang-format to try to match our style, the main problems seem to be: * pre-processor directives are indented by the same offset as code (I see that cppi is specifically intended to add just one space)
That's an interesting approach. I wouldn't object to such indentation style myself.
* function calls sometimes leave an empty opening parenthesis
* always rewrapping function arguments might create unnecessary churn * parameters wrapping might not be smart enough, e.g. we like to do virReportError(VIR_ERR_CODE, "%s", _("string")); in a lot of places.
Yeah these last two points are the ones I struggled with too when I looked at clang-format 6 months back.
The churn does worry me as it would make cherry-picking patches a big pain for downstreams.
In the long term I think we'd win by having an explicit code formatting tool that everyone is expected to comply with, even if it isn't quite the same style that we currently use.
I was also suggesting that we could use it at least in cases where the churn has already happened recently, e.g. when splitting parts of code into separate files. I have at least two series I've done recently and I have some new code which will be in separate files.