Adopt shared UniqueFd, per-config LTO, and tidy hygiene - #20
Merged
Conversation
- Hoist UniqueFd out of src/bluez/hidraw.hpp into src/utils/unique_fd.h so any client can reuse it. Add a default constructor, explicit operator bool, release(), reset(), and borrow-vs-own semantics (Borrow()) so a descriptor owned elsewhere - e.g. one received over D-Bus as sdbus::UnixFd - is not closed here. Include it directly where used, and pull hidraw.hpp into the owner headers that inherit from Hidraw rather than relying on a transitive include. - Enable LTO per configuration via CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> for Release/MinSizeRel/RelWithDebInfo, and drop the per-target set_property blocks that forced it on every build type. Debug builds no longer pay for LTO; optimized builds are unchanged. - clang-tidy: set WarningsAsErrors and a HeaderFilterRegex that excludes both third_party and the generated src/proxy headers, so a local run matches CI. - Pin cache-apt-pkgs-action and ccache-action to commit SHAs. - Remove the generated tidy-results-*.txt artifacts and ignore them. Signed-off-by: Joel Winarske <joel.winarske@linux.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bundles the well-scoped improvements suggested by the sibling-repo review (
drm-cxx,wayland-cxx-scanner). Builds clean (gcc 16 / clang 19, all 96 targets), passes clang-format--Werror, no new clang-tidy findings.UniqueFd: hoist + upgrade
UniqueFdfromsrc/bluez/hidraw.hppinto a sharedsrc/utils/unique_fd.h.explicit operator bool(),[[nodiscard]] release(),reset(fd = -1), and borrow-vs-own viaUniqueFd::Borrow(fd)— a borrowed fd is never closed. This is the escape hatch for descriptors whose lifetime is owned elsewhere, e.g. an fd received over D-Bus assdbus::UnixFd, where closing here would double-close.input_reader.hfiles now includeunique_fd.hdirectly; the owner headers that inherit fromHidrawincludehidraw.hppdirectly instead of relying on a transitive include.Per-config LTO
CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG>for Release / MinSizeRel / RelWithDebInfo, set once in the rootCMakeLists.txt.set_property(... INTERPROCEDURAL_OPTIMIZATION TRUE)blocks that forced LTO on every build type, including Debug.-fltoin 0 TUs; a Release configure emits it in all 63. Optimized builds (CI Release, default MinSizeRel) are unchanged.clang-tidy hygiene
WarningsAsErrors: '*'and aHeaderFilterRegexthat excludes boththird_partyand the generatedsrc/proxy/headers, so a localclang-tidyrun matches what CI enforces. CI still passes its own-header-filter/-warnings-as-errorson the command line, so its behavior is unchanged.CI + housekeeping
cache-apt-pkgs-actionandccache-actionto commit SHAs (# v1retained as a comment), matching howactions/*are pinned in this repo.tidy-results-log.txt/tidy-results-suggested-fixes.txtand addedtidy-results-*.txtto.gitignore.Deliberately not included
The two larger architectural suggestions — migrating fallible device I/O to
std::expected<T, std::error_code>, and a uniformfd() + set_handler() + dispatch()pollable-source contract to replace the per-client worker-thread/mutex pattern — are broad refactors of the error and threading models. They belong in their own focused change rather than folded in here.