Skip to content

Commit 7d83563

Browse files
dschogitster
authored andcommitted
clar(win32): avoid compile error due to unused fs_copy()
When CLAR_FIXTURE_PATH is unset, the `fs_copy()` function seems not to be used. But it is declared as `static`, and GCC does not like that, complaining that it should not be declared/defined to begin with. We could mark this function as (potentially) unused by following the `MAYBE_UNUSED` pattern from Git's `git-compat-util.h`. However, this is a GCC-only construct that is not understood by Visual C. Besides, `clar` does not use that pattern at all. Instead, let's use the `((void)SYMBOL);` pattern that `clar` already uses elsewhere; This avoids the compile error by sorta kinda make the function used after a fashion. Note: GCC 14.x (which Git for Windows' SDK already uses) is able to figure out that this function is unused even though there are recursive calls between `fs_copy()` and `fs_copydir_helper()`; Earlier GCC versions do not detect that, and therefore the issue has been hidden from the regular Linux CI builds (where GCC 14.x is not yet used). That is the reason why this change is only made in the Windows-specific portion of `t/unit-tests/clar/clar/fs.h`. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 42020d2 commit 7d83563

File tree

1 file changed

+2
-0
lines changed
  • t/unit-tests/clar/clar

1 file changed

+2
-0
lines changed

t/unit-tests/clar/clar/fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ cl_fs_cleanup(void)
297297
{
298298
#ifdef CLAR_FIXTURE_PATH
299299
fs_rm(fixture_path(_clar_path, "*"));
300+
#else
301+
((void)fs_copy); /* unused */
300302
#endif
301303
}
302304

0 commit comments

Comments
 (0)