Skip to content

Commit 9214daa

Browse files
andy31415andreilitvinrestyled-commits
authored
Update pigweed to the latest version (#35644)
* Pull latest pigweed * Make pigweed pull python 3.11 on macs, to have a consistent build environment * Restyle * Remove unused import * Update signature of WriteLine - this was updated in pigwed to use std::string_view pass by value * Workaround for slc errors for efr32 * Disable openssl warning of invalid function cast. This is already covered in connect.c via OPENSSL_MSVC_PRAGMA and is intentional * ZAP regen because we change clang-format version * SystemConfig includes ICDServerBuildConfig.h. Add the dependency as a formal dependency * Fix typo in WriteLine parameter * Restyle * Fix the typo .. again, I had deleted the wrong thing * Look to fix openiot sdk build * Restyle * Fix clang-tidy: it became stricter on unused arguments * Fix tidy run for real this time ... at least one file passes locally * Different fix for clang-tidy, seems more targeted * More updates: -S is also a flag that clang tidy would not like according to https://github.com/llvm/llvm-project/pull/101103/files * Fix typo * Disable two more diagnostics that seem to show up in clang-tidy * Need comma for - updated config * Fix some clang-tidy findings * More clang-tidy fixes * Generate script update: make sure metadata is generated * more tidy and dependency fixes * more clang tidy make happy updates * Restyle * Fix too many args error * Clean up an odd dependency * Signature update for android test functions * Fix type cast for android callback on type * Fix the order of checks in TCP endpoint implementations to be what tests expect ... ugly that we verify input args first * Fix invalid verify * Fix typo * Additional socket checks for socket inet implementations * Self-review update * Undo merge error * Undo pigweed repo loss * One more extra check to make clang-tidy happy * One more extra check to make clang-tidy happy * Switch to nolint * Avoid large code deltas * Restyle * Restyled by clang-format * Undo changes to build of attestation_verifier: it seems not needed * Fix for clang-tidy requiring updated template keywords * Fix the template argument ... there is a 2nd invoke type * Another fix --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent a23f0bd commit 9214daa

File tree

43 files changed

+18379
-18036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+18379
-18036
lines changed

.clang-tidy

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Checks: >
2424
-bugprone-multi-level-implicit-pointer-conversion,
2525
-bugprone-narrowing-conversions,
2626
-bugprone-not-null-terminated-result,
27+
-bugprone-pointer-arithmetic-on-polymorphic-object,
2728
-bugprone-reserved-identifier,
2829
-bugprone-signed-char-misuse,
2930
-bugprone-suspicious-include,
@@ -45,6 +46,7 @@ Checks: >
4546
-clang-analyzer-security.insecureAPI.rand,
4647
-clang-analyzer-security.insecureAPI.strcpy,
4748
-clang-analyzer-unix.Malloc,
48-
-clang-diagnostic-implicit-int-conversion
49+
-clang-diagnostic-implicit-int-conversion,
50+
-clang-diagnostic-missing-template-arg-list-after-template-kw
4951
WarningsAsErrors: '*'
5052
HeaderFilterRegex: '(src|examples|zzz_generated|credentials).*(?<!third_party.*repo)'

examples/platform/ameba/pw_sys_io/sys_io_ameba.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Status WriteByte(std::byte b)
6969
}
7070

7171
// Writes a string using pw::sys_io, and add newline characters at the end.
72-
StatusWithSize WriteLine(const std::string_view & s)
72+
StatusWithSize WriteLine(std::string_view s)
7373
{
7474
size_t chars_written = 0;
7575
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/bouffalolab/common/rpc/pw_sys_io/sys_io.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Status WriteByte(std::byte b)
4242
}
4343

4444
// Writes a string using pw::sys_io, and add newline characters at the end.
45-
StatusWithSize WriteLine(const std::string_view & s)
45+
StatusWithSize WriteLine(std::string_view s)
4646
{
4747
size_t chars_written = 0;
4848
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/esp32/pw_sys_io/sys_io_esp32.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Status WriteByte(std::byte b)
9393
}
9494

9595
// Writes a string using pw::sys_io, and add newline characters at the end.
96-
StatusWithSize WriteLine(const std::string_view & s)
96+
StatusWithSize WriteLine(std::string_view s)
9797
{
9898
size_t chars_written = 0;
9999
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Status WriteByte(std::byte b)
5757
}
5858

5959
// Writes a string using pw::sys_io, and add newline characters at the end.
60-
StatusWithSize WriteLine(const std::string_view & s)
60+
StatusWithSize WriteLine(std::string_view s)
6161
{
6262
size_t chars_written = 0;
6363
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Status WriteByte(std::byte b)
5858
}
5959

6060
// Writes a string using pw::sys_io, and add newline characters at the end.
61-
StatusWithSize WriteLine(const std::string_view & s)
61+
StatusWithSize WriteLine(std::string_view s)
6262
{
6363
size_t chars_written = 0;
6464
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/nxp/pw_sys_io/sys_io_nxp.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Status WriteByte(std::byte b)
6060
}
6161

6262
// Writes a string using pw::sys_io, and add newline characters at the end.
63-
StatusWithSize WriteLine(const std::string_view & s)
63+
StatusWithSize WriteLine(std::string_view s)
6464
{
6565
size_t chars_written = 0;
6666
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/qpg/pw_sys_io/sys_io_qpg.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Status WriteByte(std::byte b)
5858
}
5959

6060
// Writes a string using pw::sys_io, and add newline characters at the end.
61-
StatusWithSize WriteLine(const std::string_view & s)
61+
StatusWithSize WriteLine(std::string_view s)
6262
{
6363
size_t chars_written = 0;
6464
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/silabs/pw_sys_io/sys_io_silabs.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Status WriteByte(std::byte b)
6363
}
6464

6565
// Writes a string using pw::sys_io, and add newline characters at the end.
66-
StatusWithSize WriteLine(const std::string_view & s)
66+
StatusWithSize WriteLine(std::string_view s)
6767
{
6868
size_t chars_written = 0;
6969
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/platform/telink/pw_sys_io/sys_io_telink.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Status WriteByte(std::byte b)
7373
}
7474

7575
// Writes a string using pw::sys_io, and add newline characters at the end.
76-
StatusWithSize WriteLine(const std::string_view & s)
76+
StatusWithSize WriteLine(std::string_view s)
7777
{
7878
size_t chars_written = 0;
7979
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));

examples/tv-casting-app/tv-casting-common/core/Command.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Command
6565

6666
// Invoke command
6767
MediaClusterBase cluster(exchangeMgr, sessionHandle, _commandContext->mEndpoint->GetId());
68-
CHIP_ERROR err = cluster.template InvokeCommand(
68+
CHIP_ERROR err = cluster.template InvokeCommand<RequestType>(
6969
_commandContext->mRequest, _commandContext,
7070
// Command success handler
7171
[](void * __context, const typename RequestType::ResponseType & response) {
@@ -146,6 +146,6 @@ struct CommandContext
146146
chip::Optional<uint16_t> mTimedInvokeTimeoutMs;
147147
};
148148

149-
}; // namespace core
150-
}; // namespace casting
151-
}; // namespace matter
149+
} // namespace core
150+
} // namespace casting
151+
} // namespace matter

scripts/run-clang-tidy-on-compile-commands.py

+9
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ def __init__(self, json_entry, gcc_sysroot=None):
8585
command_items = shlex.split(command)
8686
compiler = os.path.basename(command_items[0])
8787

88+
# Clang-tidy complains about "unused argument '-c'"
89+
# We could disable that with something like
90+
#
91+
# self.clang_arguments.append("-Wno-unused-command-line-argument")
92+
#
93+
# However that seems to potentially disable a lot, so for now just filter out the
94+
# offending argument
95+
command_items = [arg for arg in command_items if arg not in {'-c', '-S'}]
96+
8897
# Allow gcc/g++ invocations to also be tidied - arguments should be
8998
# compatible and on darwin gcc/g++ is actually a symlink to clang
9099
if compiler in ['clang++', 'clang', 'gcc', 'g++']:

scripts/run_codegen_targets.sh

+6
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ for name in $(ninja -C "$OUT_DIR" -t targets | grep -E 'dbus.*codegen:' | sed 's
5454
echo "Generating $name ..."
5555
ninja -C "$OUT_DIR" "$name"
5656
done
57+
58+
# TLV decoding metadata
59+
for name in $(ninja -C "$OUT_DIR" -t targets | grep -E '_generate' | sed 's/: .*//'); do
60+
echo "Generating $name ..."
61+
ninja -C "$OUT_DIR" "$name"
62+
done

scripts/setup/bootstrap.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,15 @@ _bootstrap_or_activate() {
133133
export PW_DOCTOR_SKIP_CIPD_CHECKS=1
134134
export PATH # https://bugs.chromium.org/p/pigweed/issues/detail?id=281
135135

136-
local _PIGWEED_CIPD_JSON="$_CHIP_ROOT/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json"
136+
local _PIGWEED_CIPD_JSON_ROOT="$_CHIP_ROOT/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup"
137+
local _PIGWEED_CIPD_JSON="$_PIGWEED_CIPD_JSON_ROOT/pigweed.json"
138+
local _PYTHON_CIPD_JSON="$_PIGWEED_CIPD_JSON_ROOT/python311.json"
137139
mkdir -p "$_PW_ACTUAL_ENVIRONMENT_ROOT"
138140
local _GENERATED_PIGWEED_CIPD_JSON="$_PW_ACTUAL_ENVIRONMENT_ROOT/pigweed.json"
139-
$_CHIP_ROOT/scripts/setup/gen_pigweed_cipd_json.py -i $_PIGWEED_CIPD_JSON -o $_GENERATED_PIGWEED_CIPD_JSON
141+
$_CHIP_ROOT/scripts/setup/gen_pigweed_cipd_json.py \
142+
-i $_PIGWEED_CIPD_JSON \
143+
-o $_GENERATED_PIGWEED_CIPD_JSON \
144+
-e darwin:$_PYTHON_CIPD_JSON
140145

141146
if test -n "$GITHUB_ACTION"; then
142147
tee <<EOF >"${_PW_ACTUAL_ENVIRONMENT_ROOT}/pip.conf"

scripts/setup/gen_pigweed_cipd_json.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import argparse
1818
import json
19+
import platform
1920

2021
_LIST_OF_PACKAGES_TO_EXCLUDE = ['fuchsia/third_party/rust/']
2122

@@ -32,12 +33,26 @@ def include_package(package: dict) -> bool:
3233
return True
3334

3435

35-
def generate_new_cipd_package_json(input, output):
36+
def generate_new_cipd_package_json(input, output, extra):
3637
with open(input) as ins:
3738
packages = json.load(ins)
39+
3840
file_packages = packages.get('packages')
3941
new_file_packages = [x for x in file_packages if include_package(x)]
4042

43+
# Extra is a list of platform:json.
44+
# Filter it for the given platform and append any resulting packages
45+
my_platform = platform.system().lower()
46+
for item in extra:
47+
inject_platform, path = item.split(':', 1)
48+
49+
if inject_platform.lower() != my_platform:
50+
continue
51+
52+
with open(path) as ins:
53+
for package in json.load(ins).get('packages'):
54+
new_file_packages.append(package)
55+
4156
new_packages = {'packages': new_file_packages}
4257
with open(output, 'w') as f:
4358
json.dump(new_packages, f, indent=2)
@@ -54,6 +69,11 @@ def main():
5469
parser.add_argument(
5570
'--output', '-o', required=True
5671
)
72+
parser.add_argument(
73+
'--extra', '-e', nargs='*', default=[],
74+
help="Inject extra packages for specific platforms. Format is <platform>:<path_to_json>"
75+
)
76+
5777
generate_new_cipd_package_json(**vars(parser.parse_args()))
5878

5979

0 commit comments

Comments
 (0)