[GRASS-dev] Proposal for using ClangFormat, replacing GNU indent, for C/C++ code formatting
Markus Neteler
neteler at osgeo.org
Mon Jan 2 04:48:46 PST 2023
Hi Nicklas,
On Wed, Dec 21, 2022 at 9:25 PM Nicklas Larsson via grass-dev
<grass-dev at lists.osgeo.org> wrote:
>
> I understand there is agreement on using the .clang-format formatting rules suggested with [1], which I just merged.
>
> I have formatted the whole source base with clang-format v.15.0.6, in 7 different PRs [2-8]. I will start merging them tomorrow if there are no objections.
>
> I have also filed a PR [9] which adds a CI check for clang-format errors.
Thanks for your efforts on the code reformatting!
> Installing clang-format is perhaps most easily done with:
> python -m pip install 'clang-format==15.0.6'
>
> Formatting may be done with something like (following works on Mac):
> find -E . -regex '.*\.(cpp|hpp|c|h)' -exec clang-format -i {} \+
... it fails on Linux, though
find: unknown predicate `-E')
> Contribution rules must be updated, I will start putting up a draft ASAP.
I am trying to fix the conflicts in
https://github.com/OSGeo/grass/pull/2684
Conflicting files:
include/grass/iostream/mm.h
lib/db/dbmi_base/dbmscap.c
lib/external/ccmath/ccmath.h
lib/gis/spawn.c
lib/gis/user_config.c
lib/iostream/rtimer.cpp
lib/pngdriver/graph_set.c
lib/rst/interp_float/point2d.c
raster/r.terraflow/filldepr.cpp
raster/r.terraflow/flow.cpp
raster/r.terraflow/main.cpp
raster/r.viewshed/statusstructure.cpp
The reason will be the missing clang-format update which I don't know
how to apply on Linux.
Markus
PS: If easy on Mac, feel free to directly push an update to the PR :-)
More information about the grass-dev
mailing list