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

Even Rouault even.rouault at spatialys.com
Thu Nov 24 05:11:56 PST 2022


I'm pretty sure that in the past I've fought against issues related to 
include orders, at least on some platforms, and some things were beyond 
our control (system headers or dependency headers), so I think it is 
best to exclude it for now as Alessandro just did for something that is 
intended to be stylistic only and should have zero influence on the 
resulting binary code.

Le 24/11/2022 à 12:24, Javier Jimenez Shaw a écrit :
> 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 <http://www.itopen.it>
>
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org
>     https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221124/b15ad674/attachment.htm>


More information about the gdal-dev mailing list