Discussion:
Tool for checking coding style in Linaro Toolchain
Virendra Kumar Pathak
2015-06-03 06:39:51 UTC
Permalink
Hi Linaro Toolchain Group,

Is there any tool for checking coding style of the patches submitted to the
Linaro Toolchain ?
In other word is there any equivalent of Linux checkpatch.pl in Linaro
Toolchain (GCC, Binutils etc) ?
If yes, please let me know.

If not, then in general how people check the coding style of the patches
they submit to Linaro Toolchain (GCC, Binutils etc).
I assume manual inspection (line by line) may be very tedious thing to do.

Thanks.
--
with regards,
Virendra Kumar Pathak
Kugan
2015-06-03 08:07:47 UTC
Permalink
Post by Virendra Kumar Pathak
Hi Linaro Toolchain Group,
Is there any tool for checking coding style of the patches submitted to
the Linaro Toolchain ?
In other word is there any equivalent of Linux checkpatch.pl
<http://checkpatch.pl> in Linaro Toolchain (GCC, Binutils etc) ?
If yes, please let me know.
If not, then in general how people check the coding style of the patches
they submit to Linaro Toolchain (GCC, Binutils etc).
I assume manual inspection (line by line) may be very tedious thing to do.
Toolchain related patches go through the upstream review process first
and gets committed there before being back-ported to Linaro branches.
Therefore they follow the same coding standard requirement of the
upstream project. You can refer to the upstream project's coding
standard and associated scripts. For gcc, in the contrib directory there
is a script called check_GNU_style.sh which can help to some extend.

Thanks,
Kugan
Yury Gribov
2015-06-03 09:24:12 UTC
Permalink
Post by Kugan
Post by Virendra Kumar Pathak
Hi Linaro Toolchain Group,
Is there any tool for checking coding style of the patches submitted to
the Linaro Toolchain ?
In other word is there any equivalent of Linux checkpatch.pl
<http://checkpatch.pl> in Linaro Toolchain (GCC, Binutils etc) ?
If yes, please let me know.
If not, then in general how people check the coding style of the patches
they submit to Linaro Toolchain (GCC, Binutils etc).
I assume manual inspection (line by line) may be very tedious thing to do.
Toolchain related patches go through the upstream review process first
and gets committed there before being back-ported to Linaro branches.
Therefore they follow the same coding standard requirement of the
upstream project. You can refer to the upstream project's coding
standard and associated scripts. For gcc, in the contrib directory there
is a script called check_GNU_style.sh which can help to some extend.
People have been pointing at clang-format recently but AFAIK support for
GNU formatting (used in GCC and Binutils) is still infant.

-Y
Renato Golin
2015-06-03 09:35:30 UTC
Permalink
People have been pointing at clang-format recently but AFAIK support for GNU
formatting (used in GCC and Binutils) is still infant.
Patches welcome! :)

More seriously, we also recommend clang-format on all LLVM projects,
though some formatting for specific sub-projects (ex. lld) is still
lacking. There are those that prefer that way, so that we have a
consistent formatting across all sub projects, but that's not
realistic for GNU sub-projects.

cheers,
--renato

Maxim Kuvyrkov
2015-06-03 08:32:39 UTC
Permalink
Post by Virendra Kumar Pathak
Hi Linaro Toolchain Group,
Is there any tool for checking coding style of the patches submitted to the Linaro Toolchain ?
In other word is there any equivalent of Linux checkpatch.pl in Linaro Toolchain (GCC, Binutils etc) ?
If yes, please let me know.
If not, then in general how people check the coding style of the patches they submit to Linaro Toolchain (GCC, Binutils etc).
I assume manual inspection (line by line) may be very tedious thing to do.
Linaro toolchain follows upstream toolchain projects coding style, which is GNU Coding Standard. There is no checker for it that I know of, but you can use "indent" to format your code according to the style, see [1].

Note, that in Linaro Toolchain, like in most Linaro projects, upstream comes first -- in our case this means that we only have patches in our toolchain that are committed or approved upstream. E.g., improvement committed to upstream trunk (gcc-6) is appropriate to be included into Linaro's gcc-5 branch; but a patch rejected for upstream trunk will not make it into Linaro's toolchain.

For the above reason you may need to consider submitting your changes directly to upstream toolchain projects. You can still CC us on such a submission and ask us to review it or help otherwise.

[1] http://stackoverflow.com/questions/411249/coding-style-checker-for-c

Thank you,

--
Maxim Kuvyrkov
www.linaro.org
Loading...