Skip to content
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
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:

# The glue test under sanitizers as well (plan 9.3): tap.python's lock, and a reload racing a
# message on another thread, live in the glue, which the core's battery cannot see.
# The tsan row builds with Clang: from GCC 14 on (ubuntu-latest's is 15), GCC cannot compile the
# readerwriterqueue min-api pins under TSan, which puts no_sanitize("thread") after a function's
# declarator, where only Clang accepts it. The source/projects CMakeLists says when that ends.
linux-max-glue:
name: linux-max-glue (${{ matrix.name }})
runs-on: ubuntu-latest
Expand All @@ -89,12 +92,18 @@ jobs:
- name: release
build_type: Release
sanitize: ""
cc: gcc
cxx: g++
- name: asan-ubsan
build_type: Debug
sanitize: "address,undefined"
cc: gcc
cxx: g++
- name: tsan
build_type: Debug
sanitize: "thread"
cc: clang
cxx: clang++
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
Expand All @@ -113,10 +122,22 @@ jobs:
if: matrix.sanitize != ''
run: sudo sysctl vm.mmap_rnd_bits=28

# Ubuntu packages Clang's sanitizer runtimes apart from Clang (a recommends, not a depends),
# so install them for the runner's default clang when the image does not have them.
- name: Install Clang's sanitizer runtimes
if: matrix.cxx == 'clang++'
run: |
v=$(clang++ -dumpversion | cut -d. -f1)
dpkg -s "libclang-rt-$v-dev" >/dev/null 2>&1 \
|| { sudo apt-get update -q && sudo apt-get install -y -q "libclang-rt-$v-dev"; }
clang++ --version | head -1

- name: Configure
run: >
cmake -S . -B build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.cc }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
-DPython3_EXECUTABLE="$(which python)"
-DTAP_PYTHON_SANITIZE="${{ matrix.sanitize }}"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ concurrency:

jobs:
drift:
uses: tap/taphouse/.github/workflows/drift-check.yml@v7
uses: tap/taphouse/.github/workflows/drift-check.yml@v8
with:
ref: v7
ref: v8
icon: PythonTap

clang-format:
Expand Down
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ python3 runtime-tests/run.py
```

CI (`build.yml`): `linux-core` and `linux-max-glue` (each release, asan-ubsan, tsan — the glue
test's `TAP_PYTHON_SANITIZE`, as the core's; the release row also runs `scripts/check-docs.py`), `book`, `macos` (universal + `lipo`/`otool` checks, including
test's `TAP_PYTHON_SANITIZE`, as the core's — the glue's tsan row builds with Clang, since GCC 14+
cannot compile min-api's pinned readerwriterqueue under TSan, and configure says so; the release row also runs `scripts/check-docs.py`), `book`, `macos` (universal + `lipo`/`otool` checks, including
no absolute rpath, and the package assembled, which fails without `init/tap.python.txt`), `windows`. `style.yml`: TapHouse drift check,
clang-format, clang-tidy (a clang-tidy failure or crash fails the gate, not just a finding). Workflows
run with `contents: read`, pin third-party actions by commit SHA (tag noted beside it), and cancel
Expand Down
7 changes: 5 additions & 2 deletions STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ greenfield `*Tap` code follows the naming rules above.
- **Extension:** `.h` for headers (family-wide).
- **Header guard:** `#pragma once` (first line after the banner). Universally
supported by GCC/Clang/MSVC; replaces the `#ifndef`/`#define`/`#endif` triple.
- **Per-file banner:** three lines —
- **Per-file banner:** the `@file` / `@brief` pair, then the SPDX line and
the family's copyright line, which names the author and the library's
contributors (`<Library>` is the repo's name: DspTap, SampleRateTap, …;
the year is the file's) —
```cpp
/// @file spsc_ring.h
/// @brief Lock-free single-producer single-consumer ring buffer.
// SPDX-License-Identifier: MIT
// Copyright 2025-2026 Timothy Place.
// Copyright 2026 Timothy Place and the <Library> contributors
```
- **Doc comments:** `///` triple-slash with `@`-style commands
(`@param`, `@return`, `@throws`, `@pre`). Not the `\`-command dialect.
Expand Down
23 changes: 17 additions & 6 deletions scripts/tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,33 @@ if [ "${TIDY_RECONFIGURE:-0}" = "1" ] || [ ! -f "$build/compile_commands.json" ]
cmake -B "$build" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON >/dev/null
fi

# File list: the given TUs, or — matching CI exactly — every project TU in the
# database with third_party/ and fetched deps (_deps) excluded.
# File list: the given TUs, or — matching CI — every project TU in the
# database with third_party/ and fetched deps (_deps) excluded, each FILE once.
# `clang-tidy -p` checks every compile command the database holds for a file,
# so a source compiled several times under different -D (benchmark workloads,
# size probes) must be listed once: one entry per command checked a file
# compiled n times n^2 times (SampleRateTap's CI sweep, 40 entries for one
# workload source, ran past its 30-minute timeout; listed once, under five
# minutes). Built with a read loop, not mapfile, so macOS /bin/bash 3.2 runs
# the sweep too.
files=()
if [ "$#" -gt 0 ]; then
files=("$@")
else
mapfile -t files < <(python3 -c "
while IFS= read -r f; do
files+=("$f")
done < <(python3 -c "
import json
for e in json.load(open('$build/compile_commands.json')):
f = e['file']
files = [e['file'] for e in json.load(open('$build/compile_commands.json'))]
for f in dict.fromkeys(files):
if 'third_party' not in f and '_deps' not in f:
print(f)")
fi

echo "== clang-tidy ($tidy) over ${#files[@]} file(s) =="
fail=0
for f in "${files[@]}"; do
# ${files[@]+...}: an empty list under set -u is an error before bash 4.4.
for f in ${files[@]+"${files[@]}"}; do
out="$("$tidy" -p "$build" "$f" 2>/dev/null || true)"
# Test the captured output in-process, never through a pipe. Under pipefail,
# `printf '%s\n' "$out" | grep -q …` fails whenever grep quits at its first
Expand Down
15 changes: 15 additions & 0 deletions source/projects/tap.python_tilde/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,21 @@ if (TAP_PYTHON_SANITIZE AND TARGET ${PROJECT_NAME}_test)
# stops at in every test; the rest of UBSan stays on
list(APPEND _sanitize -fno-sanitize=vptr)
endif ()
if (TAP_PYTHON_SANITIZE MATCHES "thread" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
# GCC answers __has_feature from GCC 14 on, and under TSan the readerwriterqueue min-api pins
# (a500a29) then puts no_sanitize("thread") after the declarator of function definitions,
# where only Clang accepts it (GCC 13 has no __has_feature, so the macro stayed empty). Its
# 5904a29 fixed that, and is the first to test __SANITIZE_THREAD__: until min-api pins it,
# say so here rather than in a page of compile errors. CI's tsan row builds with Clang.
file(READ "${C74_MIN_API_DIR}/include/readerwriterqueue/atomicops.h" _atomicops)
if (NOT _atomicops MATCHES "__SANITIZE_THREAD__")
message(FATAL_ERROR
"TAP_PYTHON_SANITIZE=thread: GCC ${CMAKE_CXX_COMPILER_VERSION} cannot compile the "
"readerwriterqueue min-api pins under ThreadSanitizer. Configure with Clang "
"(-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++), or GCC 13.")
endif ()
endif ()
target_compile_options(${PROJECT_NAME}_test PRIVATE ${_sanitize} -fno-omit-frame-pointer)
target_link_options(${PROJECT_NAME}_test PRIVATE ${_sanitize})
set_tests_properties(${PROJECT_NAME}_test PROPERTIES ENVIRONMENT "ASAN_OPTIONS=detect_leaks=0")
Expand Down
Loading