From: Thomas Weißschuh Date: Thu, 30 Nov 2023 22:26:27 +0000 (+0100) Subject: libblkid: avoid use of non-standard typeof() X-Git-Tag: v2.40-rc1~132^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c81f7efc978aa384be7afb0b2ebefdb010e496a0;p=thirdparty%2Futil-linux.git libblkid: avoid use of non-standard typeof() __typeof__ is also non-standard but it's obviously so and consistent with the rest of the codebase. Signed-off-by: Thomas Weißschuh --- diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c index f6f34bbad6..8381528698 100644 --- a/libblkid/src/superblocks/bcache.c +++ b/libblkid/src/superblocks/bcache.c @@ -189,7 +189,7 @@ static int bcache_verify_checksum(blkid_probe pr, const struct blkid_idmag *mag, return 0; /* up to the end of bcs->d[] */ - csummed_size = offsetof(typeof(*bcs), d) + + csummed_size = offsetof(__typeof__(*bcs), d) + sizeof(bcs->d[0]) * le16_to_cpu(bcs->keys); csummed = blkid_probe_get_sb_buffer(pr, mag, csummed_size); csum = ul_crc64_we(csummed + BCACHE_SB_CSUMMED_START, @@ -238,7 +238,7 @@ static void probe_bcachefs_sb_members(blkid_probe pr, uint64_t sectors = 0; uint8_t i; - if (BYTES(field) != offsetof(typeof(*members), members[bcs->nr_devices])) + if (BYTES(field) != offsetof(__typeof__(*members), members[bcs->nr_devices])) return; blkid_probe_set_uuid_as(pr, members->members[dev_idx].uuid, "UUID_SUB"); @@ -258,7 +258,7 @@ static void probe_bcachefs_sb_disk_groups(blkid_probe pr, struct bcachefs_sb_field_disk_groups *disk_groups = (struct bcachefs_sb_field_disk_groups *) field; - if (BYTES(field) != offsetof(typeof(*disk_groups), disk_groups[bcs->nr_devices])) + if (BYTES(field) != offsetof(__typeof__(*disk_groups), disk_groups[bcs->nr_devices])) return; blkid_probe_set_id_label(pr, "LABEL_SUB", diff --git a/libblkid/src/superblocks/zonefs.c b/libblkid/src/superblocks/zonefs.c index 8aa45b0d34..e8fcab34fe 100644 --- a/libblkid/src/superblocks/zonefs.c +++ b/libblkid/src/superblocks/zonefs.c @@ -54,7 +54,7 @@ static int zonefs_verify_csum(blkid_probe pr, const struct zonefs_super *sb) uint32_t expected = le32_to_cpu(sb->s_crc); uint32_t crc = ul_crc32_exclude_offset( ~0LL, (unsigned char *) sb, sizeof(*sb), - offsetof(typeof(*sb), s_crc), sizeof(sb->s_crc)); + offsetof(__typeof__(*sb), s_crc), sizeof(sb->s_crc)); return blkid_probe_verify_csum(pr, crc, expected); }