Skip to content

Ci multiplatform#2

Open
naelolaiz wants to merge 15 commits into
qt6_migration_and_cifrom
ci-multiplatform
Open

Ci multiplatform#2
naelolaiz wants to merge 15 commits into
qt6_migration_and_cifrom
ci-multiplatform

Conversation

@naelolaiz

Copy link
Copy Markdown
Member

No description provided.

naelolaiz added 10 commits May 21, 2026 04:38
Drop the in-house threading wrappers in CLAM/src/System/Threads/
and switch every consumer to <mutex>, <thread>, <chrono> directly.

- CLAM::Mutex / TryMutex / ScopedLock -> std::mutex + std::lock_guard /
  std::unique_lock(std::try_to_lock).
- CLAM::Thread (Start/Stop/IsRunning/SetThreadCode) -> std::thread
  with lambda callables; cooperative cancellation via existing flags.
- xtime_get -> std::chrono::steady_clock.
- CBL::Functor0 method-binding dropped in favor of [this]{ ... } lambdas.
- BufferedSDIFFileReader takes ownership of its worker thread instead
  of receiving an external Thread*.
- FileSystem singleton: =default ctor/dtor, std::mutex guard, range-for
  in callers.
- Range-based for loops where iterator/index was unused.

Removes 17 files under CLAM/src/System/Threads/. CMake glob no longer
points at the deleted directory. No remaining consumer of the old
headers in the buildable tree.

Assisted by Claude Opus 4.7
Mechanical sweep across the buildable tree. Diagnostic strings that
embedded the word NULL are rewritten as "null" to read naturally
after the swap.

Also remove the legacy '#define NULL (0L)' shim from OSDefines.hxx.
The shim's symmetric mate '#define nullptr (0L)' was getting picked
up after this rename and broke std::list::push_back on libstdc++ 15
by deducing nullptr_t as long int inside __exchange/release.

Assisted by Claude Opus 4.7
First batch of iterator-pattern -> range-based for-loop conversions.
Also opportunistically replaces explicit iterator types with auto.

  CLAM/src/Processing/Plugins/RunTimeLibraryLoader.cxx
  CLAM/src/Processing/SDIFIO/LoopingSDIFFileReader.cxx
  NetworkEditor/src/MainWindow.hxx
  NetworkEditor/src/ProcessingTree.cxx

More files to follow.

Assisted by Claude Opus 4.7
Convert empty Foo::Foo() / Foo::~Foo() bodies to =default, where
no member initializers or side effects are present.

Assisted by Claude Opus 4.7
Adds an optional CppUnit detection path and registers
test/NonPortedTests/TestThreading.cxx (already rewritten to use
std::mutex/std::thread/std::chrono) as a ctest-runnable target,
gated on BUILD_TESTING.

Assisted by Claude Opus 4.7
include(CTest) at the top-level defaults BUILD_TESTING=ON, which
triggers the cppunit detection branch in CLAM/CMakeLists.txt and
fails configure on a fresh ubuntu-latest image.

Assisted by Claude Opus 4.7
- TraverseDirectory: rewrite on top of std::filesystem::recursive_
  directory_iterator. Drops the WIN32 vs POSIX split entirely
  (FindFirstFile/dirent.h gone), drops the dead Skip* declarations
  that never had a definition, =defaults the ctor/dtor.
- RunTimeLibraryLoader: opendir/readdir/closedir -> directory_iterator;
  CompletePathFor()'s opendir+fopen probes -> is_directory +
  is_regular_file; range-for over environment paths.
- RunTimeLadspaLibraryLoader / RunTimeFaustLibraryLoader: drop dead
  <dirent.h> include.
- MpegCodec: stat()/struct stat -> std::filesystem::file_size().

Assisted by Claude Opus 4.7
ExecState only appears in equality comparisons and switches, never
gets implicitly converted to int, and the unscoped names (Ready,
Running, Unconfigured) crowd Processing's public namespace. Convert
to scoped enum class and qualify the call sites.

Assisted by Claude Opus 4.7
In C, 'enum X { ... }' makes the type 'enum X', so the typedef
trick to drop the 'enum' tag was necessary. In C++, 'enum X { ... }'
is already the type name. Rewrite all 20 occurrences to the plain
C++ form.

Not promoted to 'enum class' here because the values participate in
CLAM::Enum / CLAM::Flags / bitwise ops that require implicit int
conversion. Just the C-ism is removed.

Assisted by Claude Opus 4.7
throw() and noexcept have identical observable behaviour on
violation (program terminates), but throw() is deprecated in C++11,
removed in C++17, banned in C++20. Replace empty dynamic-exception
specifications across the project. Only the empty form was used --
no throw(SomeType) specs to translate.

Assisted by Claude Opus 4.7
@naelolaiz
naelolaiz force-pushed the ci-multiplatform branch 4 times, most recently from f608b8d to 3da5e5d Compare May 22, 2026 14:52
naelolaiz and others added 5 commits May 22, 2026 17:39
Thirteen files in CLAM/src, CLAM/examples, CLAM/plugins, CLAM/test
and SMSTools/test were still encoded in ISO-8859-1 with raw 0xB2 /
0xB3 (superscript 2 / 3) bytes in comments. Convert in place to
UTF-8 with iconv so the rest of the tree -- and any tooling that
edits files via a UTF-8 layer -- stops mangling those bytes to
U+FFFD.

No content change beyond the encoding; the visible characters
(superscripts in math comments, etc.) remain the same.

Assisted by Claude Opus 4.7
QFirstPerson was the only caller of glu*. Replace:
- gluPerspective() -> QMatrix4x4::perspective() + glLoadMatrixf().
- gluSphere() / GLUquadric -> small inline drawSphere() helper
  that emits the same GL_QUAD_STRIP geometry with outward normals,
  matching the fixed-function style of the rest of the file.

The CLAMGL.hxx shim in SMSTools/vmqt also pulled in <GL/glu.h> /
<OpenGL/glu.h>, but no SMSTools translation unit calls any glu*
symbol; the include was dead and is dropped.

CMake no longer searches for libGLU in NetworkEditor or SMSTools;
README's apt-install list drops libglu1-mesa-dev. With GLU gone,
the macOS and Windows builds can enable CLAM_BUILD_GUI_APPS without
needing a GLU package.

Assisted by Claude Opus 4.7
Compile and link on clang/libc++ (macOS) and MSVC (Windows) without
regressing GCC/Linux:

- Source: drop libc++-removed std::mem_fun; replace VLAs with
  std::vector; list::remove(&x) -> find+erase (MSVC 14.44 STL bug);
  drop out-of-class default args (clang strict); namespace-wrap an
  explicit template instantiation; rewrite the pthread_t-based
  AudioPlayer with std::thread.
- Platform gates: x87 inline asm to _MSC_VER && _M_IX86; legacy
  <cmath> shims to _MSC_VER < 1900; pthread / sched code to !_WIN32;
  AudioFile's MpegCodec dispatch to USE_MAD && USE_ID3; MIDISettings'
  portmidi block to USE_PORTMIDI (not WIN32).
- CMake: cppunit detection with find_path/library fallback on
  Windows + vcpkg; vorbis transitive deps on macOS / Windows
  (pkg-config there doesn't chase Requires.private); sndfile include
  propagated publicly on Windows only; clam_qtmonitors STATIC on
  Windows to dodge the AutoRCC / WINDOWS_EXPORT_ALL_SYMBOLS race;
  OpenGL::GL paired with Qt6::OpenGL via
  $<$<PLATFORM_ID:Windows>:OpenGL::GL> so Qt6::OpenGL's missing
  opengl32 linkage is repaired only on Windows.
- Windows DLL boundary: move static class data members to headers
  as 'static inline' (SpecTypeFlags::sFlagValues,
  OutControlSenderConfig::E{ControlRepresentation,Mapping}::s{EnumValues,
  Default}, ErrAssertionFailed::breakpointInCLAMAssertEnabled) --
  CMake's WINDOWS_EXPORT_ALL_SYMBOLS does not auto-export those.
- Tidy: TestThreading uses an init-capture for nthreads; remove the
  dead InitAudioIO / InitProcessing stubs from four main.cxx files
  (the actual headers and types were deleted in 2008 along with the
  old VisualC support).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- ClamNetworkCanvas: bind ProcessingDataPlugin::colorFor()'s temporary
  std::string before calling .c_str() so QColor doesn't read freed
  memory (-Wdangling-gsl).
- OneOverF: bit-equality test used '&&' where '&' was meant, so each
  iteration compared the same boolean instead of bit i
  (-Wconstant-logical-operand).
- SpectralPeakArray, FDFilterGen: compare against TData(0.0001) so the
  comparison isn't always false because float can't represent 0.0001
  exactly (-Wliteral-range).
- SMSBase: initialise ePercentil/eThr/fPercentil/fThr/minLength at
  declaration so they are defined on every path the optimiser cannot
  prove unreachable (-Wsometimes-uninitialized).

Cleanups that also remove warnings:
- SinTrackVClipper: '!outcodei & 0x01' -> 'outcodei == Inside'.
- Spectrum::SetTypeSynchronize: '|' on bool flags -> '||'.
- TonalAnalysis / Segmentator / SpectralPeakDescriptors: explicit
  conversions where pair<double,double> / int / 0. meets pair<TData,
  TData> / TData (silences MSVC C4244).
- ScopePool: three iterator for-loops -> range-for, dropping the dead
  loop counter.
- MIDIDispatcher / MIDITempo / OfflineNetworkPlayer: remove counters
  whose only readers were commented-out code.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- macOS-latest: brew-install cppunit + the audio deps; disable
  CLAM_WITH_LADSPA and CLAM_WITH_ALSA (Linux-only).
- windows-latest: vcpkg for xerces-c, fftw3, libsndfile, libvorbis,
  libmad, cppunit, portaudio; Qt 6.8.3 via jurplel/install-qt-action;
  disable CLAM_WITH_LADSPA / LV2 / JACK / ALSA / ID3.
- vcpkg binary cache: Microsoft removed the 'x-gha' backend, so
  persist a files-backed cache via actions/cache@v4 keyed on triplet
  + vcpkg commit + dep list. First run still does a full vcpkg
  build (~15 min); subsequent runs unpack archives instead of
  compiling.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@naelolaiz
naelolaiz marked this pull request as ready for review May 22, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant