Commit Graph

1810 Commits

Author SHA1 Message Date
Claude
b113f0a7d8 feat(tidy): add fairmq-readability-transfer-code
- Replace -1, -2 and -3 in == and != comparisons with the result of
  Send() or Receive() by static_cast<int64_t>(fair::mq::TransferCode::X).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:29:18 +00:00
Claude
e9afe76155 feat(tidy): add fairmq-bugprone-use-after-send
- Report uses of a MessagePtr after a Send() whose result is discarded.
  After the send the message is empty with zeromq, and still points to
  the sent buffer with shmem, so the same code acts differently per
  transport.
- Walk the CFG from the send with ExprSequence, like
  bugprone-use-after-move. A loop back to the send counts as a use.
- Assignment, reset(), Rebuild(), a new declaration in a loop and
  passing by non-const reference (e.g. to Receive()) give a new message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:29:18 +00:00
Claude
3b3446bfcb feat(tidy): add fairmq-bugprone-unchecked-transfer-result
- Report Receive() calls whose result is discarded. On a timeout, an
  error or an interrupt the message stays empty, and only the result
  tells.
- Report Send() too with the option CheckSend: true. Off by default,
  because many devices ignore the result of Send() on purpose.
- A cast to void discards the result on purpose and is not reported.
- Add Transfer.h with matchers for Send() and Receive() of Device,
  Channel and Socket, and isDiscarded(), for this and later checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:29:18 +00:00
Claude
64ec4d7afa test(tidy): support check options and checks without a fix
- RunCheck.cmake passes a `// TIDY-CONFIG: <yaml>` line of the input to
  --config, e.g. to set check options.
- ClangdCheck.py requires a quick fix only if the input has CHECK-FIXES
  lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:28:53 +00:00
Claude
8ee2518fb1 feat(options): deprecate the old ProgOptions accessors
- Mark GetValue<T>(), SetValue() and GetStringValue() as deprecated in
  favour of the property API, as the TODO comments ask.
- fairmq-modernize-progoptions-accessors migrates the calls.
- List them in the migration guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:28:50 +00:00
Claude
aed31b4090 refactor(examples): use the property API of ProgOptions
- Replace GetValue<T>() with GetProperty<T>(). All read keys are
  declared options, so GetProperty<T>() without a default fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:28:29 +00:00
Claude
871e7e54cf feat(tidy): add fairmq-modernize-run-device
- Migrate a device main file from <runFairMQDevice.h> to
  <fairmq/runDevice.h>: the include, the FairMQDevicePtr return type,
  the const ProgOptions& parameter and 'return new T(...)', which becomes
  'return std::make_unique<T>(...)'.
- Fix all of it or nothing: if a return statement of getDevice() is not
  a plain new expression, only report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:28:29 +00:00
Claude
67fd7f2305 feat(tidy): add fairmq-modernize-progoptions-accessors
- Replace GetValue<T>(key) with GetProperty<T>(key, {}) and
  GetStringValue(key) with GetPropertyAsString(key, {}). The {} default
  keeps the old result for an unknown key, where the property API throws.
- Replace SetValue() with SetProperty() only where its always-zero
  result is unused, because SetProperty() returns void.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:28:29 +00:00
Claude
83d0e741f5 feat(tidy): add fairmq-modernize-parts-api
- Replace Parts::AtRef(i) with Parts::At(i). At() returns a reference
  to the MessagePtr, so a following '.' becomes '->', and a lone call
  gets a leading '*'.
- Wrap the raw pointer of Parts::AddPart(Message*) in
  fair::mq::MessagePtr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:28:29 +00:00
Claude
3975017183 feat(tidy): add fairmq-modernize-deprecated-functions
- Replace Device::GetStateName() and Device::GetTransitionName() with
  the free functions fair::mq::GetStateName() and GetTransitionName().
- Replace Socket::GetConstant() of the zeromq and shmem transports with
  fair::mq::zmq::getConstant() and include <fairmq/zeromq/Common.h>.
- Report Socket::Close() without a fix: the socket closes when it is
  destroyed, so the call must go away, not be renamed.
- Skip the fix if the object expression has side effects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:28:23 +00:00
Claude
75fd9622e2 docs(tidy): describe the plugin and fairmq-clangd
- Explain how to load libfairmq-tidy-checks.so into clang-tidy, and
  that the clang-tidy must have the same LLVM major version.
- Explain the editor setup with fairmq-clangd and a .clangd file,
  including FastCheckFilter for clangd >= 18.
- Add BUILD_TIDY_CLANGD to the CMake reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:27:51 +00:00
Claude
ba0a696e8c ci: build and test the tidy plugin and fairmq-clangd
- Install clang-tidy and the gRPC libraries that clangd links.
- Build fairmq-tidy-plugin and fairmq-clangd in the tidy-tool job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:26:45 +00:00
Claude
661fc96fbb feat(tidy): add fairmq-clangd for editor integration
- Add the option BUILD_TIDY_CLANGD (default OFF). It builds
  fairmq-clangd from clangdMain plus the fairmq-* module.
- clangd cannot load plugins, but creates its clang-tidy checks from the
  same registry. Thus the checks run on the AST that clangd builds anyway,
  and editors show their fixes as quick fixes.
- Point clangd to the resource directory of the LLVM installation it was
  built with, unless --resource-dir is given.
- Test each check over LSP with test/tidy/ClangdCheck.py: open the input,
  expect a diagnostic of the check and a quick fix for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:26:45 +00:00
Claude
622daae350 feat(tidy): build the checks as a clang-tidy plugin
- Add the MODULE library fairmq-tidy-plugin, installed as
  libfairmq-tidy-checks.so. It adds the fairmq-* checks to a stock
  clang-tidy of the same LLVM release via --load.
- Do not link the LLVM libraries into the plugin: the loading clang-tidy
  has them.
- Run every check test also through the plugin, if a clang-tidy of the
  found LLVM installation exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:26:45 +00:00
Claude
1a7b9a73a7 docs(tidy): describe the clang-tidy based fairmq-tidy
- Rewrite the tool reference and the guide for the clang-tidy driver:
  the options, --fix, the default check selection, run-clang-tidy and
  --warnings-as-errors for CI.
- Describe each check, list the build requirements and the tested LLVM
  releases.
- Document the CHECKS and EXTRA_ARGS arguments of fairmq_target_tidy().
- Update the pages that name the dependencies and the migration guide:
  the checks now find the old headers, InputMsgCallback and friends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:26:37 +00:00
Claude
78d764bcd3 ci: build and test fairmq-tidy against LLVM 17 to 20
- Add a tidy-tool job with one entry per LLVM release of the Ubuntu
  24.04 archive. It builds fairmq-tidy and runs the tidy.* tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:35 +00:00
Claude
22d7eb671f build(tidy): select the checks in fairmq_target_tidy()
- Add a CHECKS argument (default fairmq-*), passed as --checks=-*,<globs>,
  so that a project .clang-tidy file does not change what runs.
- Make EXTRA_ARGS a multi-value argument.
- Drop the clang resource directory lookup for GCC builds: fairmq-tidy
  knows it. Accept CLANG_EXECUTABLE for compatibility, without effect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:35 +00:00
Claude
84ac7aecfd feat(tidy): add fairmq-modernize-channels-access
- Report uses of the deprecated member fair::mq::Device::fChannels.
- Replace fChannels.at(name).at(index) with GetChannel(name, index) and
  every other use with GetChannels().
- Ignore uses inside fair::mq::Device itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:27 +00:00
Claude
d4a3c06c7b feat(tidy): add fairmq-modernize-deprecated-headers
- Report includes of the ten deprecated headers, e.g. <FairMQDevice.h>
  or <fairmq/FairMQDevice.h>, and replace them with the successor, e.g.
  <fairmq/Device.h>. Today these headers only emit a #pragma warning.
- Keep the quote style of the include.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:27 +00:00
Claude
e32bee2533 test(tidy): check the fairmq-* checks with FileCheck
- Add test/tidy/RunCheck.cmake, a small check_clang_tidy.py: run one
  check with --fix on a copy of the input, then match the diagnostics
  against CHECK-MESSAGES lines and the fixed file against CHECK-FIXES
  lines. Any other warning or error fails the test.
- Register one test per test/tidy/fairmq-*.cxx file. The inputs use the
  real FairMQ headers via the usage requirements of the FairMQ target.
- Skip the tests with a warning if FileCheck is not found.
- Add the test for fairmq-modernize-nonnamespaced-types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:27 +00:00
Claude
cbcd0d3324 refactor(tidy)!: rebuild fairmq-tidy on top of clang-tidy
- Implement the checks as a clang-tidy module (object library
  fairmq-tidy-module) instead of a standalone LibTooling program.
- Build fairmq-tidy from clangTidyMain plus the module. It gets all
  clang-tidy features: --fix, --export-fixes, .clang-tidy files, NOLINT,
  header filter, and the upstream checks on the same parse.
- Without a --checks option, add fairmq-* to the configured checks.
- Point the driver to the resource directory of the LLVM installation it
  was built with, so it finds the Clang builtin headers from any install
  location. The -I hint in fairmq_target_tidy() is no longer necessary.
- Add the include directories of LLVM and Clang. The old target compiled
  only where they are in /usr/include.
- Port fairmq-modernize-nonnamespaced-types. Match deprecated global
  aliases into fair::mq instead of the name prefix "FairMQ": this also
  finds e.g. InputMsgCallback and skips aliases that are not deprecated.
  Match only the TypedefTypeLoc, so each use is reported once.

BREAKING CHANGE: fairmq-tidy takes the options of clang-tidy and reads
.clang-tidy files. With no .clang-tidy file it now also runs the default
clang-tidy checks (clang-diagnostic-*, clang-analyzer-*).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:27 +00:00
Claude
2fea52a071 fix(tidy): find LLVM and Clang of the same installation
- Enable the C language before find_package(LLVM): LLVMConfig.cmake runs C
  compile checks and fails without it, e.g. with LLVM 17 on Ubuntu.
- Look for Clang next to the found LLVM first. Before, a failed LLVM
  lookup let Clang pull in another LLVM version silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:22 +00:00
Claude
85ab7e4b1c build(tidy): drop dependencies the tool does not use
- Require FairLogger and Boost only for BUILD_FAIRMQ; fairmq-tidy uses
  neither of them.
- Do not require CLI11; the tool never used it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:23:22 +00:00
Claude
e2a150d9e8 build(cmake): install public headers with a header file set
- Add the public headers and the generated Version.h to the file set
  HEADERS of FairMQ
- Install the file set instead of one install(FILES) per header
- The file set gives the include directory include/fairmq; the exported
  target also adds it for CMake versions before 3.23
- The installed headers are the same

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
230a614bb1 build(cmake): build bundled GoogleTest with FetchContent
- Add the bundled GoogleTest with FetchContent and OVERRIDE_FIND_PACKAGE,
  so it uses the compiler and flags of the FairMQ build
- Build it in a block() without gmock, install and static analysis
- Replace build_bundled() with fairmq_init_submodule(), which runs
  git submodule update only if the submodule folder is empty, and stops
  with a clear error if it stays empty
- Install the bundled FairCMakeModules into the build directory with its
  tests off, as before
- Use the bundled PicoSHA2 headers directly from the source tree
- With USE_EXTERNAL_GTEST, GTest is a private dependency and no longer
  in FairMQ_PACKAGE_DEPENDENCIES

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
08d371b1d4 build(cmake): use CMAKE_COLOR_DIAGNOSTICS for colored output
- Set CMAKE_COLOR_DIAGNOSTICS instead of adding -fdiagnostics-color to
  CMAKE_CXX_FLAGS and setting CMAKE_COLOR_MAKEFILE
- CMake adds the correct flag for each compiler
- Keep a CMAKE_COLOR_DIAGNOSTICS value given by the user, except with
  DISABLE_COLOR=ON
- The color flag is no longer part of FairMQ_CXX_FLAGS in the package

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
13739445e8 docs(cmake): document add_subdirectory support and the target changes
- FairMQ::FairMQ exists in the build tree
- FairMQ uses PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR
- The exported library links Boost::headers

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
7b2923d6d5 refactor(cmake): drop legacy export option and public test includes
- EXPORT_LINK_INTERFACE_LIBRARIES has no effect with policy CMP0022
- Test targets are executables, so their include directories are private

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
44bdfe9ddc refactor(cmake): link CMAKE_DL_LIBS and Boost::headers
- Use the platform variable instead of the literal dl
- Use Boost::headers instead of the legacy alias Boost::boost

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
268fcafcc6 feat(cmake): add the FairMQ::FairMQ alias target to the build tree
- Projects that add FairMQ with add_subdirectory() use the same target
  name as projects that use the installed package

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
0dfbb73d86 refactor(cmake): use PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR
- CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR point to the top-level project
  and break add_subdirectory() and FetchContent
- Find the helper modules relative to the CMakeLists.txt that includes them
- Replace @CMAKE_BINARY_DIR@ in the example test scripts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
ba286b4449 docs(cmake): document the CMake 3.25 minimum
- Update the dependency table, the build options and the test helper

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
6afa1b7aa1 ci: test the minimum CMake version
- Build, test and check the installation with CMake 3.25.0 from PyPI

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
c8d9fe355d refactor(cmake): replace fairmq_build_option with CMake commands
- Use option() and cmake_dependent_option() directly
- Keep the error for BUILD_TESTING or BUILD_EXAMPLES without BUILD_FAIRMQ
- Option names and defaults are unchanged

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
d4644ae33a build!: require CMake 3.25
- Raise the minimum from 3.15 to 3.25 and the policy range to 3.31
- Remove the 3.22 version guards for ENVIRONMENT_MODIFICATION
- Link the GoogleTest target GTest::gtest, which FindGTest and the
  GoogleTest package config both provide

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:32 +01:00
Claude
6cce60be0a refactor(cmake): remove the Boost::boost fallback
- Boost::headers exists in every supported FindBoost and BoostConfig
- The else branch could never run

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
a167e96dbd refactor(cmake): remove unused asio find module and bundle script
- Nothing includes Findasio.cmake or extern/bundled_asio.cmake
- FairMQ uses Boost.Asio and has no asio submodule

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
043dd323a4 docs(cmake): describe the fixed CMake behavior
- Remove the notes about the empty FairMQ_PACKAGE_COMPONENTS, the typo in
  the Boost.Asio definition, the unused IWYU variable and the
  installed start scripts
- Document that the installed scripts use the install-time prefix and
  that FairMQ no longer sets CMAKE_CONFIGURATION_TYPES

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
201d784ee4 fix(examples): drop the empty transport suffix from the test name
- A NO_TRANSPORT example is now the test Example.<name>
- The test script no longer gets an empty transport argument

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
9447556d7c fix(examples): use the installed program directory for built-in devices
- Installed programs are in <prefix>/bin, not <prefix>/bin/fairmq
- Installed start scripts did not find the built-in devices

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
ac1857c7d8 ci: check the installed package with a downstream project
- Install to a prefix, relocate it and build a minimal consumer that uses
  find_package(FairMQ) and FairMQ::FairMQ
- Fail if documented package variables are missing or if installed files
  still refer to the original prefix

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
488bbddf9c fix(examples): resolve the install prefix at install time
- Configure installed example scripts and topologies in install(CODE) so
  cmake --install --prefix and DESTDIR produce correct paths
- Drop the second configure_file() copy per script
- Remove the stale fairmq/sdk directory from the build-tree PATH
- Remove commented-out DDS test blocks

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
2061b8636d fix(cmake): drop misspelled BOOST_ASIO_HAS_HAS_STD_CHRONO definition
- The macro name is a typo and has no effect
- It was exported to every consumer as a PUBLIC definition

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
cd29ff72be fix(cmake): parse multi-digit ZeroMQ version components
- The version regexes accepted a single digit only
- A version such as 4.3.10 was misread

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
29060378b7 fix(cmake): respect multi-config generators
- Set a default CMAKE_BUILD_TYPE only for single-config generators
- Stop overriding CMAKE_CONFIGURATION_TYPES
- Do not require CMAKE_BUILD_TYPE when generating the package config

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
b6407c53a4 fix(cmake): use the real variables for static analysis tools
- CMAKE_CXX_IWYU is not a CMake variable. Use
  CMAKE_CXX_INCLUDE_WHAT_YOU_USE and the include-what-you-use program
- Store find_program results in their own variables instead of misusing
  the *_FOUND names as cache entries

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
7d268912ae fix(cmake): find git with find_package(Git)
- The old check dereferenced GIT_EXECUTABLE, so it tested an empty name
  and re-ran find_program every time by accident
- FindGit provides the same GIT_EXECUTABLE variable

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
1a98b90d09 fix(cmake): remove stray brace from package components list
- The list name contained a trailing brace, so the joined string was empty
- The installed FairMQConfig.cmake then set FairMQ_PACKAGE_COMPONENTS to
  an empty value

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:21:31 +01:00
Claude
25f44828d7 docs(shmem): document that sender and receiver must use the same kind of type
- shmem uses one metadata format for a single message and another for
  a multipart message; Receive(Parts) of a single send, or
  Receive(MessagePtr) of a multipart send, gives wrong metadata or a
  crash
- Add a sender/receiver table to the messages page of the
  documentation and a note to Channel::Receive()
- Update the source line links into Channel.h
- Keep PartsTransfer.SingleSendMultipartReceive disabled: a fix
  changes the shmem wire format

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 15:42:53 +01:00
Claude
102cdaf40e fix(shmem): refuse to send an empty Parts
- zeromq refuses an empty Parts with TransferCode::error; shmem sent a
  message with zero parts and returned 0, and the receiver got a
  Receive() with zero parts
- Refuse it in shmem too, with the same warning
- Enable PartsTransfer.EmptyPartsIsRefused
- Update the documentation pages that described the defect, and
  the source line links into the changed files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 15:42:53 +01:00