Skip to content
Draft
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
21 changes: 20 additions & 1 deletion .github/workflows/cpp-ci-serial-programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
run: |
sudo apt update
sudo apt upgrade
sudo apt install libopencv-dev
sudo apt install libopencv-dev clang-tools
sudo apt install ./Arduino-Source/3rdPartyBinaries/libdpp-10.0.28-linux-x64.deb
- name: Install dependencies
if: startsWith(matrix.os, 'mac')
Expand All @@ -68,6 +68,25 @@ jobs:
cd bin
cmake .. -DQT_MAJOR:STRING=${{ matrix.qt_version_major }} ${{ matrix.cmake_additional_param }}
cmake --build . --config RelWithDebInfo --parallel 10
- name: Run clang query
if: startsWith(matrix.os, 'ubuntu')
run : |
cd Arduino-Source
echo 'match cxxConstructExpr( ' >> query.txt
echo ' hasDeclaration(cxxConstructorDecl(ofClass(hasName("std::filesystem::path")))),' >> query.txt
echo ' hasArgument(0, ' >> query.txt
echo ' ignoringParenImpCasts( ' >> query.txt
echo ' hasType(hasDeclaration(hasName("std::basic_string"))) ' >> query.txt
echo ' ) ' >> query.txt
echo ' ) ' >> query.txt
echo ') ' >> query.txt
files=$(jq -r '.[].file' SerialPrograms/bin/compile_commands.json)
clang-query -p SerialPrograms/bin/ -f query.txt /home/runner/work/Arduino-Source/Arduino-Source/Arduino-Source/SerialPrograms/Source/CommonFramework/Globals.cpp
echo "$files" | xargs --max-args=150 clang-query -p SerialPrograms/bin/ -f query.txt >> output.txt
if grep --silent "Match #" output.txt; then
echo "::error Forbidden std::filesystem::path construction detected!"
exit 1
fi
- name: Prepare upload folder
if: startsWith(matrix.os, 'windows')
run: |
Expand Down
2 changes: 2 additions & 0 deletions SerialPrograms/Source/CommonFramework/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ namespace {

void set_program_path(const char* argv0){
if (argv0 != nullptr) {
std::string str{};
std::filesystem::path{str}
std::filesystem::path program_path(argv0);
g_program_absolute_path = std::filesystem::absolute(program_path).string();
g_program_filename = program_path.filename().string();
Expand Down
Loading