Skip to content
Open
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
5 changes: 5 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,11 @@ is_formatter = true
[[linter]]
code = 'CPP_BANNED_FUNCTIONS'
include_patterns = [
'backends/arm/**/*.c',
'backends/arm/**/*.cc',
'backends/arm/**/*.cpp',
'backends/arm/**/*.h',
'backends/arm/**/*.hpp',
'examples/arm/**/*.c',
'examples/arm/**/*.cc',
'examples/arm/**/*.cpp',
Expand Down
6 changes: 6 additions & 0 deletions backends/arm/runtime/EthosUBackend_Cortex_A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ Error invoke_linux_driver(
}
} // namespace

// Used by EthosUBackend.cpp through EthosUBackend_Internal.h.
// cppcheck-suppress unusedFunction
PlatformState* platform_init(
ArrayRef<CompileSpec> specs,
MemoryAllocator* allocator) {
Expand All @@ -335,10 +337,14 @@ PlatformState* platform_init(
return state;
}

// Used by EthosUBackend.cpp through EthosUBackend_Internal.h.
// cppcheck-suppress unusedFunction
void platform_destroy(PlatformState* state) {
delete state;
}

// Used by EthosUBackend.cpp through EthosUBackend_Internal.h.
// cppcheck-suppress unusedFunction
Error platform_execute(
BackendExecutionContext& /*context*/,
const ExecutionHandle* execution_handle,
Expand Down
2 changes: 1 addition & 1 deletion backends/arm/runtime/VGFBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,4 +1063,4 @@ VkResult vkml_allocate_basics(

} // namespace vgf
} // namespace backends
} // namespace executorch
} // namespace executorch
10 changes: 9 additions & 1 deletion backends/arm/runtime/VGFNeuralStatistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ std::string serialize_vgf_neural_statistics_collection(
return out.str();
}

// Used by vgf_neural_statistics_test.cpp through VGFNeuralStatistics.h.
// cppcheck-suppress unusedFunction
std::string make_vgf_neural_statistics_unavailable_metadata(
const std::string& reason) {
VgfNeuralStatisticsCollection collection;
Expand All @@ -498,6 +500,8 @@ std::string make_vgf_neural_statistics_unavailable_metadata(
return serialize_vgf_neural_statistics_collection(collection);
}

// Used by VGFSetup.cpp and tests through VGFNeuralStatistics.h.
// cppcheck-suppress unusedFunction
std::string collect_vgf_neural_statistics_metadata(
VkDevice device,
const std::vector<VgfNeuralStatisticsSegmentContext>& segments) {
Expand All @@ -510,15 +514,19 @@ std::string collect_vgf_neural_statistics_metadata(
collect_vgf_neural_statistics(device, segments));
}

// Used by vgf_neural_statistics_test.cpp through VGFNeuralStatistics.h.
// cppcheck-suppress unusedFunction
void set_vgf_neural_statistics_collector_for_test(
VgfNeuralStatisticsCollectorForTest collector) {
test_collector_storage() = std::move(collector);
}

// Used by vgf_neural_statistics_test.cpp through VGFNeuralStatistics.h.
// cppcheck-suppress unusedFunction
void reset_vgf_neural_statistics_collector_for_test() {
test_collector_storage() = nullptr;
}

} // namespace vgf
} // namespace backends
} // namespace executorch
} // namespace executorch
82 changes: 14 additions & 68 deletions backends/arm/scripts/banned_functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,99 +9,45 @@
"replacements": ["fgets"]
},
{
"names": ["memcpy"],
"replacements": ["memcpy_s"]
"names": ["atof"],
"replacements": ["strtod"]
},
{
"names": ["wmemcpy"],
"replacements": ["wmemcpy_s"]
"names": ["atoi", "atol", "atoll"],
"replacements": ["strtol", "strtoll", "strtoul", "strtoull"]
},
{
"names": ["memmove"],
"replacements": ["memmove_s"]
"names": ["rewind"],
"replacements": ["See SEI CERT MSC24-C: https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/recommendations/miscellaneous-msc/msc24-c/"]
},
{
"names": ["wmemmove"],
"replacements": ["wmemmove_s"]
"names": ["setbuf"],
"replacements": ["setvbuf"]
},
{
"names": ["readdir_r"],
"replacements": ["readdir"]
},
{
"names": ["scanf", "wscanf", "_tscanf", "sscanf", "swscanf", "_stscanf"],
"replacements": ["fgets"]
},
{
"names": [
"strcat",
"wcscat",
"_tcscat",
"_mbscat",
"StrCat",
"lstrcat",
"lStrCatBuff",
"_tccat",
"_mbccat",
"_ftcscat",
"strncat",
"wcsncat",
"_tcsncat",
"_mbsncat",
"_mbsnbcat",
"StrCatN",
"StrNCat",
"lstrncat",
"lstrcatn"
"wcscat"
],
"replacements": ["strcat_s", "strncat_s"]
"replacements": ["See SEI CERT STR31-C: https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/rules/characters-and-strings-str/str31-c/"]
},
{
"names": [
"strcpy",
"wcscpy",
"_tcscpy",
"_mbscpy",
"StrCpy",
"lstrcpy",
"_tccpy",
"_mbccpy",
"_ftcscpy",
"strncpy",
"wcsncpy",
"_tcsncpy",
"_mbsncpy",
"_mbsnbcpy",
"StrCpyN",
"StrNCpy",
"lstrcpyn"
"wcscpy"
],
"replacements": ["strcpy_s", "strncpy_s"]
},
{
"names": ["strlen"],
"replacements": ["strnlen_s"]
},
{
"names": ["wcslen"],
"replacements": ["wcsnlen_s"]
},
{
"names": ["strtok", "_tcstok", "wcstok", "_mbstok"],
"replacements": ["strtok_s"]
"replacements": ["See SEI CERT STR31-C: https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/rules/characters-and-strings-str/str31-c/"]
},
{
"names": [
"wsprintf",
"sprintf",
"swprintf",
"_stprintf",
"wvsprintf",
"vsprintf",
"_vstprintf",
"vswprintf"
"vsprintf"
],
"replacements": ["snprintf", "snprintf_s"]
"replacements": ["snprintf", "vsnprintf"]
}
]
}
6 changes: 4 additions & 2 deletions backends/arm/scripts/banned_functions.json.license
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SPDX-FileCopyrightText: Copyright 2026 Arm Limited and/or its affiliates <open-source-office@arm.com>
SPDX-License-Identifier: MIT

File copied from https://github.com/justinchuby/lintrunner-adapters/ which has an MIT license.
File permalink: https://github.com/justinchuby/lintrunner-adapters/blob/772e5936d9b02814e29e12ca1355d33b029688c2/examples/adapters/cpp_banned_functions_linter/example_banned_functions.json
Derived from the MIT-licensed example at:
https://github.com/justinchuby/lintrunner-adapters/blob/772e5936d9b02814e29e12ca1355d33b029688c2/examples/adapters/cpp_banned_functions_linter/example_banned_functions.json

Modified for the ExecuTorch Arm backend.
Loading