Repository navigation
fix(clang-tidy): replace C-style arrays with std::array - #1233
Conversation
| // NOLINTNEXTLINE(modernize-avoid-c-arrays):C-style array tolerated for command line arguments. This API is deprecated | ||
| // and it will be removed. | ||
| // C-style array tolerated for command line arguments. This API is deprecated and it will be removed. | ||
| // NOLINTNEXTLINE(modernize-avoid-c-arrays) |
There was a problem hiding this comment.
The problem doing it like that is that it would then fail the check that a suppression should have an argumentation. Not sure what would be the right solution.
There was a problem hiding this comment.
I do not believe that we have such check right now
There was a problem hiding this comment.
Ok, lets cross that bridge when we come to it. For the moment I will approve it and once we have a checker and this violates, we should be able to fine the argumentation quite easy because it is just above.
The only quesiton remaining would be, do we think that having a checker that all suppressions should have a justification attached is important? If yes I would create a ticket for it to not forget and we can merge this PR.
There was a problem hiding this comment.
As the safety argumentation will be done via CodeQL - I don't think it is worth the hassle
a72347f to
4a5a890
Compare
Resolve all 11 modernize-avoid-c-arrays findings: - std::array for padding members, the pipe fds, the shm path buffer and the placement-new storage in the EXPORT_MW_COM_TYPE macro (covers the 7 findings in the generated *_gen.cpp files). - runtime.cpp: the deprecated InitializeRuntime(argc, argv[]) must keep its signature; move the NOLINTNEXTLINE directly above the declaration so it actually applies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ipse-score#1250) ## Summary Fixes the remaining `cppcoreguidelines-pro-bounds-array-to-pointer-decay` findings in `sample_sender_receiver.cpp`: - `ToStringImpl` takes its variadic arguments by `const Args&...`, so string literals no longer decay when recursing. - The one remaining decay (`o << t` for string literals) gets a justified `NOLINTNEXTLINE`. The other 9 alerts of this check (`flock_test.cpp`, `last_shm_open_path_`, and the `*_gen.cpp` macro storage) are C-style arrays that are replaced by `std::array` in eclipse-score#1233; they disappear once that is merged (verified by linting that branch). ## Verification - clang-tidy on this branch: only the findings covered by eclipse-score#1233 remain - `bazel test //score/mw/com/test/common_test_resources/... //score/mw/com/test/bigdata/...` pass
Summary
Fixes all 11
modernize-avoid-c-arraysfindings.std::arrayforpadding(generic skeleton apps),client_pipe_fds(flock_test.cpp),last_shm_open_path_(sample_sender_receiver.cpp) and the placement-newstoragein theEXPORT_MW_COM_TYPEmacro (7 findings in the generated*_gen.cppfiles).runtime.cpp: the deprecatedInitializeRuntime(argc, argv[])keeps its signature; itsNOLINTNEXTLINEwas separated from the declaration by a comment line and therefore did not apply. It now sits directly above the function.Verification
bazel build --config=ci //score/...andbazel test //score/mw/com/...pass