[gdal-dev] SortIncludes was Re: Motion: adopt RFC69 C/C++ Code Formatting

Javier Jimenez Shaw j1 at jimenezshaw.com
Thu Nov 24 03:24:49 PST 2022


In my opinion if the order of the includes affects the output there is
something wrong in the code. I hope md5 is not recommending the order.

I find the ordering feature very useful as a way to detect those errors
(not definitive because it is not testing every combination, but a fixed
criterion is good).

In case you insist on keeping the order defined by the user (more for
aesthetic reasons usually) you can just add a newline to separate the
includes in blocks. Clang-format keeps the contiguous blocks independent.

On Thu, 24 Nov 2022, 11:21 ElPaso, <elpaso at itopen.it> wrote:

> Il 24/11/22 10:55, Andrew C Aitchison ha scritto:
> > On Thu, 24 Nov 2022, ElPaso wrote:
> >
> >> Hi,
> >>
> >> Motion:
> >>
> >> Adopt RFC88: RFC69 C/C++ Code Formatting [1]
> >>
> >> I have updated the RFC [1] to use pre-commit and I have created a
> >> draft implementation of the pre-commit hook and the CI integration
> >> with a GH workflow [2].
> >>
> >> If adopted, we still have to agree on which coding style to apply
> >> (for now I used a clang-format file I've found under gdal/scripts),
> >> but the biggest decision is wether proceed with an initial "Big
> >> Reformat" or an incremental one, my draft implementation supports both.
> >>
> >> Kind regards.
> >>
> >> [1]
> >>
> https://github.com/elpaso/gdal/blob/rfc69_cplusplus_formatting-text-only/doc/source/development/rfc/rfc69_cplusplus_formatting.rst
> >> [2]
> >> https://github.com/elpaso/gdal/tree/rfc69_cplusplus_formatting_revival
> >
> > I have just tried this on my driver code and am concerned that the
> > default sets --sort-includes.
>
> [...]
>
>
> > So without tweaking, clang-format is potentially breaking my code.
> > I fear that we need a project .clang-formats file with atleast
> > SortIncludes:    false
> >
>
> Good point, added:
>
> https://github.com/elpaso/gdal/commit/c54d54d209ce28c2017b3ebb0bcc1d23c5472693
>
>
> --
> Alessandro Pasotti
> w3: www.itopen.it
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221124/0f762603/attachment-0001.htm>


More information about the gdal-dev mailing list