Skip to content

Fix clang-tidy benign warnings #185

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

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
Checks:
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,-modernize-use-trailing-return-type'
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,
-modernize-use-trailing-return-type,-bugprone-easily-swappable-parameters,-readability-identifier-length'
WarningsAsErrors: '*'
HeaderFilterRegex: 'include/aws/.*\.h$'
FormatStyle: 'none'
Expand Down
5 changes: 5 additions & 0 deletions ci/codebuild/format-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ FAIL=0
SOURCE_FILES=$(find src include tests -type f -name "*.h" -o -name "*.cpp")
for i in $SOURCE_FILES
do
if [[ "$i" == *"gtest.h" || "$i" == *"backward.h" ]]; then
continue
fi

echo "$i\n"
if [ $($CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement ") -ne 0 ]
then
echo "$i failed clang-format check."
Expand Down
3 changes: 1 addition & 2 deletions include/aws/lambda-runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ class invocation_response {
bool is_success() const { return m_success; }
};

struct no_result {
};
struct no_result {};

class runtime {
public:
Expand Down
9 changes: 7 additions & 2 deletions src/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <cassert>
#include <chrono>
#include <array>
#include <iterator>
#include <cstdlib> // for strtoul
#include <cinttypes>

Expand Down Expand Up @@ -133,12 +134,16 @@ static size_t read_data(char* buffer, size_t size, size_t nitems, void* userdata
}

if (unread <= limit) {
std::copy_n(ctx->first.begin() + ctx->second, unread, buffer);
auto from = ctx->first.begin();
std::advance(from, ctx->second);
std::copy_n(from, unread, buffer);
ctx->second += unread;
return unread;
}

std::copy_n(ctx->first.begin() + ctx->second, limit, buffer);
auto from = ctx->first.begin();
std::advance(from, ctx->second);
std::copy_n(from, limit, buffer);
ctx->second += limit;
return limit;
}
Expand Down