]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
kbuild: Fix CC_CAN_LINK detection
authorMickaël Salaün <mic@digikod.net>
Thu, 12 Feb 2026 13:35:43 +0000 (14:35 +0100)
committerNathan Chancellor <nathan@kernel.org>
Fri, 13 Feb 2026 19:23:06 +0000 (14:23 -0500)
Most samples cannot be build on some environments because they depend
on CC_CAN_LINK, which is set according to the result of
scripts/cc-can-link.sh called by cc_can_link_user.

Because cc-can-link.sh must now build without warning, it may fail
because it is calling printf() with an empty string:

  + cat
  + gcc -m32 -Werror -Wl,--fatal-warnings -x c - -o /dev/null
  <stdin>: In function ‘main’:
  <stdin>:4:9: error: zero-length gnu_printf format string [-Werror=format-zero-length]
  cc1: all warnings being treated as errors

Fix this warning and the samples build by actually printing something.

Cc: stable@vger.kernel.org
Fixes: d81d9d389b9b ("kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings")
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20260212133544.1331437-1-mic@digikod.net
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
scripts/cc-can-link.sh

index e67fd8d7b6841e53341045b28dc5196cc1327cbe..58dc7dd6d55689a8142ce50687fce4ba4c2d55d4 100755 (executable)
@@ -5,7 +5,7 @@ cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/null 2>
 #include <stdio.h>
 int main(void)
 {
-       printf("");
+       printf("\n");
        return 0;
 }
 END