[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix some compiler warnings
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] Fix some compiler warnings |
Date: |
Wed, 18 Jan 2023 12:27:13 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Svante Signell, le mer. 18 janv. 2023 11:59:40 +0100, a ecrit:
> On Wed, 2023-01-18 at 02:02 +0100, Samuel Thibault wrote:
> > Hello,
> >
> >
> > But conversely when we'll build it in 64bit, vm_page_size (actually
> > uintptr_t) will be an unsigned long.
> >
> > This needs to be fixed the *proper* way: either use the PRIuPTR
> > macro, or cast the value into unsigned long.
>
> Now cast to an unsigned long, new patch attached.
I only took the ext2fs.c part for an example, but it's the same for all
other files.
Samuel
> Index: hurd-0.9.git20221224/ext2fs/ext2fs.c
> ===================================================================
> --- hurd-0.9.git20221224.orig/ext2fs/ext2fs.c
> +++ hurd-0.9.git20221224/ext2fs/ext2fs.c
> @@ -233,7 +233,7 @@ main (int argc, char **argv)
> ext2_panic ("device too small for superblock (%Ld bytes)", store->size);
> if (store->log2_blocks_per_page < 0)
> ext2_panic ("device block size (%zu) greater than page size (%lu)",
> - store->block_size, vm_page_size);
> + store->block_size, (unsigned long)vm_page_size);
>
> /* Map the entire disk. */
> create_disk_pager ();
> Index: hurd-0.9.git20221224/ext2fs/dir.c
> ===================================================================
> --- hurd-0.9.git20221224.orig/ext2fs/dir.c
> +++ hurd-0.9.git20221224/ext2fs/dir.c
> @@ -415,7 +415,7 @@ dirscanblock (vm_address_t blockaddr, st
> || EXT2_DIR_REC_LEN (entry->name_len) > le16toh (entry->rec_len)
> || memchr (entry->name, '\0', entry->name_len))
> {
> - ext2_warning ("bad directory entry: inode: %Ld offset: %lu",
> + ext2_warning ("bad directory entry: inode: %Ld offset: %u",
> dp->cache_id,
> currentoff - blockaddr + idx * DIRBLKSIZ);
> return ENOENT;
> Index: hurd-0.9.git20221224/libpager/data-request.c
> ===================================================================
> --- hurd-0.9.git20221224.orig/libpager/data-request.c
> +++ hurd-0.9.git20221224/libpager/data-request.c
> @@ -49,7 +49,7 @@ _pager_S_memory_object_data_request (str
> }
> if (length != __vm_page_size)
> {
> - printf ("incg data request: bad length size %lu\n", length);
> + printf ("incg data request: bad length size %u\n", length);
> goto release_out;
> }
> if (offset % __vm_page_size)
> Index: hurd-0.9.git20221224/libpager/data-return.c
> ===================================================================
> --- hurd-0.9.git20221224.orig/libpager/data-return.c
> +++ hurd-0.9.git20221224/libpager/data-return.c
> @@ -60,7 +60,7 @@ _pager_do_write_request (struct pager *p
> }
> if (length % __vm_page_size)
> {
> - printf ("incg data return: bad length size %lu\n", length);
> + printf ("incg data return: bad length size %u\n", length);
> goto release_out;
> }
> if (offset % __vm_page_size)
> Index: hurd-0.9.git20221224/libpager/data-unlock.c
> ===================================================================
> --- hurd-0.9.git20221224.orig/libpager/data-unlock.c
> +++ hurd-0.9.git20221224/libpager/data-unlock.c
> @@ -58,7 +58,7 @@ _pager_S_memory_object_data_unlock (stru
> }
> if (length != __vm_page_size)
> {
> - printf ("incg data unlock: bad length size %lu\n", length);
> + printf ("incg data unlock: bad length size %u\n", length);
> goto out;
> }
>
> Index: hurd-0.9.git20221224/ext2fs/pager.c
> ===================================================================
> --- hurd-0.9.git20221224.orig/ext2fs/pager.c
> +++ hurd-0.9.git20221224/ext2fs/pager.c
> @@ -642,7 +642,7 @@ pager_unlock_page (struct user_pager_inf
> if (err == ENOSPC)
> ext2_warning ("This filesystem is out of space.");
> else if (err)
> - ext2_warning ("inode=%Ld, page=0x%lx: %s",
> + ext2_warning ("inode=%Ld, page=0x%x: %s",
> node->cache_id, page, strerror (err));
>
> return err;
> @@ -905,7 +905,7 @@ static void
> disk_cache_init (void)
> {
> if (block_size != vm_page_size)
> - ext2_panic ("Block size %u != vm_page_size %lu",
> + ext2_panic ("Block size %u != vm_page_size %u",
> block_size, vm_page_size);
>
> pthread_mutex_init (&disk_cache_lock, NULL);
> Index: hurd-0.9.git20221224/mach-defpager/main.c
> ===================================================================
> --- hurd-0.9.git20221224.orig/mach-defpager/main.c
> +++ hurd-0.9.git20221224/mach-defpager/main.c
> @@ -43,6 +43,7 @@
> #include <hurd/port.h>
> #include <hurd/fd.h>
> #include <hurd/paths.h>
> +#include <hurd/startup.h>
> #include <assert-backtrace.h>
> /* XXX */
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.