Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code health] Perform cppcheck cleanup #3150

Merged
merged 26 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9375819
First pass
chusitoo Nov 17, 2024
b89fbde
Second pass
chusitoo Nov 18, 2024
558560e
Add cppcheck in CI
chusitoo Nov 18, 2024
67ed142
Re-order initialization of member variables
chusitoo Nov 18, 2024
e8e1b85
Fix formatting
chusitoo Nov 18, 2024
d79e186
Put back some verbosity
chusitoo Nov 18, 2024
207c3e3
Fix unintialized buffer in copy ctor
chusitoo Nov 18, 2024
9305c6c
Revert ordering of members
chusitoo Nov 19, 2024
7e1e9ca
Merge remote-tracking branch 'remotes/origin/main' into cppcheck
chusitoo Nov 19, 2024
f706996
Merge remote-tracking branch 'remotes/origin/main' into cppcheck
chusitoo Nov 19, 2024
f1b18df
Fix reorder error in maintainer mode
chusitoo Nov 19, 2024
86ddede
Merge remote-tracking branch 'remotes/origin/main' into cppcheck
chusitoo Nov 19, 2024
e9b2252
Code review feedback + minor touchup
chusitoo Nov 20, 2024
6c062f8
Code review part 2
chusitoo Nov 22, 2024
48099c2
Merge remote-tracking branch 'remotes/origin/main' into cppcheck
chusitoo Nov 22, 2024
869f157
Merge remote-tracking branch 'remotes/origin/main' into cppcheck
chusitoo Nov 22, 2024
21e6d74
Merge remote-tracking branch 'remotes/origin/main' into cppcheck
chusitoo Nov 23, 2024
f22a295
Code review part 3
chusitoo Nov 23, 2024
4f2c120
Merge branch 'main' into cppcheck
marcalff Nov 25, 2024
d8151b3
Merge branch 'main' into cppcheck
marcalff Nov 25, 2024
4a75894
Merge branch 'main' into cppcheck
marcalff Nov 27, 2024
6c6925b
Fix iwyu warnings
chusitoo Nov 28, 2024
fabee6a
Fix format order of includes
chusitoo Nov 28, 2024
72fba18
Merge branch 'main' into cppcheck
marcalff Dec 2, 2024
3e01c95
Merge branch 'main' into cppcheck
chusitoo Dec 3, 2024
e745948
Merge branch 'main' into cppcheck
marcalff Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
cppcheck:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -18,26 +18,11 @@ jobs:
- name: Set up dependencies
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends --no-install-suggests \
build-essential \
cppcheck \
cmake \
ninja-build \
libssl-dev \
libcurl4-openssl-dev \
libprotobuf-dev \
protobuf-compiler \
libgmock-dev \
libgtest-dev \
libbenchmark-dev

- name: Prepare CMake
run: |
mkdir build && cd build
CC="clang" CXX="clang++" cmake ..
sudo apt install -y cppcheck

- name: Run cppcheck
run: |
cppcheck --version | tee cppcheck.log
cppcheck \
--force \
--enable=warning,performance,portability \
Expand All @@ -60,7 +45,7 @@ jobs:
-i test \
-i third_party \
-j $(nproc) \
. 2>&1 | tee cppcheck.log
. 2>&1 | tee --append cppcheck.log

- uses: actions/upload-artifact@v4
if: success() || failure()
Expand All @@ -73,4 +58,5 @@ jobs:
set +e
COUNT=`grep -c -E "\[.+\]" cppcheck.log`
echo "cppcheck reported ${COUNT} warning(s)"
if [ $COUNT -ne 0 ] ; then exit 1 ; fi
# TODO: uncomment to enforce failing the build
# if [ $COUNT -ne 0 ] ; then exit 1 ; fi
marcalff marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ struct VariantCoreAccess {
static typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative<NewIndex, Self>::type& Replace(
Self* self, Args&&... args) {
Destroy(*self);
using New = typename absl::variant_alternative<NewIndex, Self>::type;
using New = typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative<NewIndex, Self>::type;
// cppcheck-suppress [legacyUninitvar]
New* const result = ::new (static_cast<void*>(&self->state_))
New(absl::OTABSL_OPTION_NAMESPACE_NAME::forward<Args>(args)...);
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.