- address signedness warnings with casts or type changes
- include header for function declarations
Details
Details
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
usr.sbin/makefs/Makefile | ||
---|---|---|
17 ↗ | (On Diff #28158) | WARNS higher than 3 produces a number of "cast ... increases required alignment", with one example below. Will revisit that later on. |
usr.sbin/makefs/ffs.c | ||
993 ↗ | (On Diff #28158) | WARNS higher than 3 produces: /usr/home/emaste/src/freebsd/usr.sbin/makefs/ffs.c:993:8: error: cast from 'u_char *' (aka 'unsigned char *') to 'struct direct *' increases required alignment from 1 to 4 [-Werror,-Wcast-align] de = (struct direct *)(dbuf->buf + i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
usr.sbin/makefs/ffs.c | ||
---|---|---|
993 ↗ | (On Diff #28158) | I suspect that you need to cast through uintptr_t. Like de = (struct direct *)(uintptr_t)(buf + 1); |
usr.sbin/makefs/ffs/ffs_alloc.c | ||
67 ↗ | (On Diff #28158) | Note that in-kernel ffs_hashalloc() uses the following prototype: static ufs2_daddr_t ffs_hashalloc (struct inode *, u_int, ufs2_daddr_t, int, int, allocfcn_t *); |
155 ↗ | (On Diff #28158) | Kernel uses u_int for cg and startcg. |
usr.sbin/makefs/ffs.c | ||
---|---|---|
993 ↗ | (On Diff #28158) | Yes, as long as we know that it must have the correct alignment (which is probably straightforward to demonstrate, but I haven't yet looked). I wonder though if the warning is just overly aggressive, and if we should just disable it. |
usr.sbin/makefs/ffs/ffs_alloc.c | ||
155 ↗ | (On Diff #28158) | Ok. I think I based this on fs_ncg being u_int32_t, but if kernel uses u_int it probably makes sense to follow here. |