- address signedness warnings with casts or type changes
- include header for function declarations
Details
Details
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
| usr.sbin/makefs/Makefile | ||
|---|---|---|
| 17 | 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 | 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 | 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 | 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 | Kernel uses u_int for cg and startcg. | |
| usr.sbin/makefs/ffs.c | ||
|---|---|---|
| 993 | 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 | 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. | |