[klibc] [klibc:master] losetup: Fix warnings about __u64 arguments to printf

klibc-bot for Ben Hutchings ben at decadent.org.uk
Tue Apr 27 18:12:15 PDT 2021


Commit-ID:  7599fa189ed558b94dc2bf7f38450a0972d70653
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=7599fa189ed558b94dc2bf7f38450a0972d70653
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Wed, 28 Apr 2021 03:02:14 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Wed, 28 Apr 2021 03:07:54 +0200

[klibc] losetup: Fix warnings about __u64 arguments to printf

On some 64-bit architectures __u64 is defined as unsigned long.  On
these architectures, gcc emits a series of warnings such as:

    usr/utils/losetup.c: In function 'show_loop':
    usr/utils/losetup.c:54:21: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Wformat=]

Define the necessary macro to ensure __u64 is defined as unsigned long
long everywhere, fixing these warnings.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/utils/losetup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/usr/utils/losetup.c b/usr/utils/losetup.c
index 4a85e126..16159eb0 100644
--- a/usr/utils/losetup.c
+++ b/usr/utils/losetup.c
@@ -6,6 +6,9 @@
  * losetup.c - setup and control loop devices
  */
 
+/* We want __u64 to be unsigned long long */
+#define __SANE_USERSPACE_TYPES__
+
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>


More information about the klibc mailing list