Skip to content

Commit a84ef75

Browse files
committed
fix: guard activation_finish_absent_publish behind its call-site conditions
Building on FreeBSD after syncing with upstream failed with -Werror,-Wunused-function on activation_finish_absent_publish in src/cli/activation_transaction.c. The function is only invoked from three platform-specific branches: Windows (_WIN32, MoveFileExW), macOS (__APPLE__, renameatx_np), and modern Linux (__linux__ with SYS_renameat2, via syscall). On every other POSIX target — including FreeBSD and other BSDs — control falls through to the portable linkat(2) fallback, so the helper was defined but never called, tripping -Wunused-function under -Werror. Rather than excluding FreeBSD by name (which would still break on OpenBSD, NetBSD, DragonFly, Solaris, or any Linux without SYS_renameat2), wrap the function definition in the same #if condition as its call sites. This keeps the guard mechanically tied to actual usage instead of enumerating platforms, so it stays correct as new targets are added. Signed-off-by: Pedro Ramos <131530838+pr9000@users.noreply.github.com>
1 parent d6be58e commit a84ef75

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎src/cli/activation_transaction.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,7 @@ static activation_publish_status_t activation_publish_absent_link_fallback(
16951695
}
16961696
#endif
16971697

1698+
#if defined(_WIN32) || defined(__APPLE__) || (defined(__linux__) && defined(SYS_renameat2))
16981699
static activation_publish_status_t activation_finish_absent_publish(
16991700
cbm_activation_transaction_t *transaction) {
17001701
transaction->staged_exists = false;
@@ -1705,6 +1706,7 @@ static activation_publish_status_t activation_finish_absent_publish(
17051706
? ACTIVATION_PUBLISH_OK
17061707
: ACTIVATION_PUBLISH_CHANGED_ERROR;
17071708
}
1709+
#endif
17081710

17091711
static activation_publish_status_t activation_publish_absent_replacement(
17101712
cbm_activation_transaction_t *transaction) {

0 commit comments

Comments
 (0)