Files
cnc_wams/wasm-port/tools/verify_no_standalone_cnc_semantics.sh
wangdequan c3157ee3f8 按推荐建议,继续执行
结论:新增 standalone CNC 语义守卫,禁止在 wrapper/tools/tests 中重新定义 Interp::convert_g(),确保 G-code 转换继续走 vendored LinuxCNC interp_convert.cc。
2026-06-07 18:32:36 +08:00

27 lines
753 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
TMP_FILE="$(mktemp)"
trap 'rm -f "$TMP_FILE"' EXIT
find \
"$ROOT_DIR/runtime" \
"$ROOT_DIR/tests" \
"$ROOT_DIR/tools" \
-type f \
\( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hh' -o -name '*.hpp' -o -name '*.js' -o -name '*.ts' \) \
! -path "$ROOT_DIR/vendor/*" \
! -path "$ROOT_DIR/runtime/ui/ini-panel/linuxcnc_ini.js" \
-print0 |
xargs -0 grep -nE '^[[:space:]]*int[[:space:]]+Interp::convert_g[[:space:]]*\(' > "$TMP_FILE" || true
if [[ -s "$TMP_FILE" ]]; then
echo "standalone Interp::convert_g definitions are not allowed:" >&2
cat "$TMP_FILE" >&2
exit 1
fi
echo "standalone CNC semantics guard complete"