Use clang-tidy -fix to replace 0 by nullptr#4041
Conversation
|
What is missing to this PR? |
|
There is a lot that is missing in this PR. I have applied clang-tidy only to Mesh_2 and its dependencies. I created that issue to start a discussion: do we want that tool clang-tidy applied to CGAL as a whole? And if yes, which rules of clang-tidy? So far I have experimented only with |
|
A possible path could be to extend this PR to all packages but just for |
|
I agree. We should coordinate with other massive PR, like #3895. |
|
@lrineau is this PR still needed ? If yes, then it needs an update. |
It is not "needed". That is just an improvement on CGAL code. But it is useful.
Why do you want to remove the |
|
ping @MaelRL |
|
I just meant: it could be ignored temporarily so that there is no extra pollution in the results for warnings that we know we can first fix "off-testsuite". But sure, it would be useful to have. |
fb8f274 to
cc99fd9
Compare
clang-tidy -fix to replace 0 by nullptrclang-tidy -fix to replace 0 by nullptr
|
Conflicts with master |
e1a15ff to
17602e5
Compare
|
Successfully tested in https://cgal.geometryfactory.com/CGAL/testsuite/results-5.3-Ic-106.shtml |
Summary of Changes
As a followup to #3979, and because I hear a lot about clang-tidy, I wanted to try and use clang-tidy, to see if one can automatically replace
0orNULLbynullptr. I have created a tiny.clang-tidyfile.The only check applied for now is
modernize-use-nullptr.To use it:
cmake -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-fix" buildand then I have used:
make && ctest -L Mesh_2to compile (with clang-tidy enabled) the whole testsuite of Mesh_2. The option
-fixof clang-tidy tells it to modify the source code directly. And then I have checked the results because committing: all was good. But I have modified the strange modifications made by #3979 inHash_map/include/CGAL/Tools/chained_map.h(NULLKEYhad been modified tonullptrKEYby error).Release Management
I am not 100% sure that we want to apply that sort of pull-request to
masterfor CGAL-5.0, because, like PRs #3979, #3978, and #3975, that increases the chance of conflicts with bug-fix pull-requests based on CGAL-4.13 or CGAL-4.14.