Home
last modified time | relevance | path

Searched hist:"8 a77bc5e" (Results 1 – 1 of 1) sorted by relevance

/freebsd/usr.sbin/makefs/
H A Dzfs.c8a77bc5e Sat Sep 30 18:27:20 GMT 2023 Dimitry Andric <dim@FreeBSD.org> makefs/zfs: fix build with gcc 12 after b5a2bf512dbe

Due to integer promotion rules, dn_nlevels (uint8_t) gets promoted to a
plain int, resulting in -Werror warnings with gcc 12:

In file included from /workspace/src/usr.sbin/makefs/zfs.c:35:
/workspace/src/usr.sbin/makefs/zfs.c: In function '_dnode_cursor_flush':
/workspace/src/usr.sbin/makefs/zfs.c:684:23: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
684 | assert(levels <= c->dnode->dn_nlevels - 1);
| ^~
/workspace/src/usr.sbin/makefs/zfs.c:691:27: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
691 | if (level == c->dnode->dn_nlevels - 1) {
| ^~
/workspace/src/usr.sbin/makefs/zfs.c: In function 'dnode_cursor_next':
/workspace/src/usr.sbin/makefs/zfs.c:739:41: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
739 | for (levels = 0; levels < c->dnode->dn_nlevels - 1; levels++) {
| ^

Fix it by subtracting 1U instead of 1.

Fixes: b5a2bf512dbe
MFC after: 3 days
8a77bc5e Sat Sep 30 18:27:20 GMT 2023 Dimitry Andric <dim@FreeBSD.org> makefs/zfs: fix build with gcc 12 after b5a2bf512dbe

Due to integer promotion rules, dn_nlevels (uint8_t) gets promoted to a
plain int, resulting in -Werror warnings with gcc 12:

In file included from /workspace/src/usr.sbin/makefs/zfs.c:35:
/workspace/src/usr.sbin/makefs/zfs.c: In function '_dnode_cursor_flush':
/workspace/src/usr.sbin/makefs/zfs.c:684:23: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
684 | assert(levels <= c->dnode->dn_nlevels - 1);
| ^~
/workspace/src/usr.sbin/makefs/zfs.c:691:27: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
691 | if (level == c->dnode->dn_nlevels - 1) {
| ^~
/workspace/src/usr.sbin/makefs/zfs.c: In function 'dnode_cursor_next':
/workspace/src/usr.sbin/makefs/zfs.c:739:41: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
739 | for (levels = 0; levels < c->dnode->dn_nlevels - 1; levels++) {
| ^

Fix it by subtracting 1U instead of 1.

Fixes: b5a2bf512dbe
MFC after: 3 days