Skip to content

[Common] Use const& and std::move to avoid copies - #17703

Open
vkucera wants to merge 1 commit into
AliceO2Group:masterfrom
vkucera:const-Common
Open

[Common] Use const& and std::move to avoid copies#17703
vkucera wants to merge 1 commit into
AliceO2Group:masterfrom
vkucera:const-Common

Conversation

@vkucera

@vkucera vkucera commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Mostly done automatically by Clang-Tidy.

Mostly done automatically by Clang-Tidy.
@github-actions github-actions Bot added the common label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

O2 linter results: ❌ 337 errors, ⚠️ 445 warnings, 🔕 57 disabled

@github-actions github-actions Bot changed the title Use const& and std::move to avoid copies [Common] Use const& and std::move to avoid copies Sep 1, 2026
@vkucera
vkucera marked this pull request as ready for review September 1, 2026 15:53
@alibuild

alibuild commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/staging for bec349f at 2026-09-01 20:01:

## sw/BUILD/O2Physics-latest/log
c++: fatal error: Killed signal terminated program cc1plus
ninja: build stopped: subcommand failed.

Full log here.

@alibuild

alibuild commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for bec349f at 2026-09-01 21:15:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 162 errors and 632 warnings.'
Found 162 errors and 632 warnings.
++ [[ 162 -gt 0 ]]
++ cat /sw/BUILD/1485a7395e2fbb8244750d29b083a5b9f83be69d/O2Physics-code-check/errors.txt
Common/Core/PID/PIDTOFParamService.cxx:288:8: error: destructor of 'TOFSupport' is public and non-virtual [cppcoreguidelines-virtual-class-destructor,-warnings-as-errors]
Common/Core/PID/PIDTOFParamService.cxx:301:22: error: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast,-warnings-as-errors]
Common/Core/TrackSelection.cxx:31:40: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
Common/Core/macros/testMetadataHelper.C:48:12: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
Common/Core/macros/testMetadataHelper.C:62:22: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
Common/Core/macros/testMetadataHelper.C:66:103: error: Potential leak of memory pointed to by 'value' [clang-analyzer-unix.Malloc,-warnings-as-errors]
Common/Core/macros/testMetadataHelper.C:111:20: error: comparison of integers of different signs: 'size_type' (aka 'unsigned long') and 'int' [clang-diagnostic-sign-compare,-warnings-as-errors]
Common/TableProducer/PID/pidBayes.cxx:74:8: error: constructor does not initialize these fields: ccdb, Probability [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/eseTableProducer.cxx:59:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/eseTableProducer.cxx:200:19: error: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions,-warnings-as-errors]
Common/TableProducer/eseTableProducer.cxx:222:29: error: narrowing conversion from 'value_type' (aka 'float') to 'int' [bugprone-narrowing-conversions,-warnings-as-errors]
Common/TableProducer/eseTableProducer.cxx:330:46: error: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions,-warnings-as-errors]
Common/TableProducer/eseTableProducer.cxx:332:52: error: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:72:7: error: variable 'mMu' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:73:5: error: variable 'mRunNumber' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:79:37: error: variable 'map_mfttracks' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:80:37: error: variable 'map_muontracks' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:81:26: error: variable 'map_collisions' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:82:26: error: variable 'map_has_mfttracks_collisions' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:83:26: error: variable 'map_has_muontracks_collisions' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:84:27: error: variable 'map_vtxz' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:85:25: error: variable 'map_nmfttrack' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:87:8: error: constructor does not initialize these fields: ccdbManager, fieldB [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:184:38: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:186:23: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:186:28: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:224:7: error: 'mQ' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:264:26: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:264:34: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:287:32: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:302:23: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:302:28: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:334:26: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:334:34: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:345:32: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:360:23: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:360:28: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:590:29: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data-mc.cxx:646:14: error: do not use static_cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-static-cast-downcast,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data.cxx:72:7: error: variable 'mMu' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data.cxx:73:5: error: variable 'mRunNumber' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/match-mft-mch-data.cxx:79:37: error: variable 'map_mfttracks' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
[0 more errors; see full log]

Full log here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants